Unification of several types

Yuriy Skalko yuriy.skalko at gmail.com
Thu Nov 19 10:31:16 UTC 2020


Hello,

Browsing the LyX code I've found that some types (idx_type, row_type 
etc) are defined in many places. I propose to leave only one definition 
for each type in "support/types.h" header.

class Inset {
	...
	typedef ptrdiff_t  difference_type;
	/// short of anything else reasonable
	typedef size_t     size_type;
	/// type for cell indices
	typedef size_t     idx_type;
	/// type for cursor positions
	typedef ptrdiff_t  pos_type;
	/// type for row numbers
	typedef size_t     row_type;
	/// type for column numbers
	typedef size_t     col_type;
	...
}


class Tabular {
	...
	/// type for row numbers
	typedef size_t row_type;
	/// type for column numbers
	typedef size_t col_type;
	/// type for cell indices
	typedef size_t idx_type;
	...
}


class CursorSlice {
	...
	/// type for cell number in inset
	typedef size_t idx_type;
	/// type for row indices
	typedef size_t row_type;
	/// type for col indices
	typedef size_t col_type;
	...
}


class DocIterator
{
	...
	/// type for cell number in inset
	typedef CursorSlice::idx_type idx_type;
	/// type for row indices
	typedef CursorSlice::row_type row_type;
	/// type for col indices
	typedef CursorSlice::col_type col_type;
	...
}


// TexRow.h
...
/// types for cells and math insets
typedef void const * uid_type;
typedef size_t idx_type;
...


// InsetMath.h
...
/// Type of unique identifiers for math insets (used in TexRow)
typedef void const * uid_type;
...


// support/types.h
	...
	typedef ptrdiff_t  pos_type;
	typedef ptrdiff_t  pit_type;
	typedef size_t     depth_type;
	typedef size_t     size_type;
	...


Yuriy


More information about the lyx-devel mailing list