Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
qx-textpos.h
1#ifndef QX_TEXTPOS_H
2#define QX_TEXTPOS_H
3
4// Shared Lib Support
5#include "qx/io/qx_io_export.h"
6
7// Extra-component Includes
8#include "qx/core/qx-index.h"
9
10// TODO: This class should probably be constexpr construable, though this
11// would mean it cant have separate implementation files which is somewhat ugly.
12// probably should reconsider this once using modules.
13
14namespace Qx
15{
16
17class QX_IO_EXPORT TextPos
18{
19//-Instance Variables------------------------------------------------------------------------------------------------
20private:
21 Index32 mLine;
22 Index32 mCharacter;
23
24//-Constructor-------------------------------------------------------------------------------------------------------
25public:
26 TextPos();
27 TextPos(Extent e);
28 TextPos(Index32 line, Index32 character);
29
30//-Instance Functions------------------------------------------------------------------------------------------------
31public:
32 Index32 line() const;
33 Index32 character() const;
34 void setLine(Index32 line);
35 void setCharacter(Index32 character);
36 bool isNull() const;
37
38 bool operator==(const TextPos& other) const noexcept = default;
39 std::strong_ordering operator<=>(const TextPos& other) const noexcept;
40};
41
42}
43
44#endif // QX_TEXTPOS_H
The TextPos class is used to represent an offset within a text file in terms of lines and characters.
Definition qx-textpos.h:18
bool operator==(const TextPos &other) const noexcept=default
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5
Extent
Definition qx-global.h:18