/usr/include/wallsprojectparser.h is in libdewalls-dev 1.0.0+ds1-4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | #ifndef DEWALLS_WALLSPROJECTPARSER_H
#define DEWALLS_WALLSPROJECTPARSER_H
#include <QObject>
#include <QList>
#include <QString>
#include <QStringList>
#include <QDir>
#include <QSharedPointer>
#include <QFile>
#include "unitizeddouble.h"
#include "dewallsexport.h"
#include "angle.h"
#include "length.h"
#include "wallsmessage.h"
#include "lineparser.h"
namespace dewalls {
class Segment;
struct DEWALLS_LIB_EXPORT GeoReference {
typedef UnitizedDouble<Length> ULength;
typedef UnitizedDouble<Angle> UAngle;
// positive for north, negative for south
int zone;
ULength northing;
ULength easting;
UAngle gridConvergence;
ULength elevation;
UAngle latitude;
UAngle longitude;
int wallsDatumIndex;
QString datumName;
};
typedef QSharedPointer<GeoReference> GeoReferencePtr;
class WpjEntry;
class WpjBook;
typedef QSharedPointer<WpjEntry> WpjEntryPtr;
typedef QSharedPointer<WpjBook> WpjBookPtr;
///
/// \brief an item in a Walls project tree (a book, survey, or other file)
///
class DEWALLS_LIB_EXPORT WpjEntry {
public:
enum ReviewUnits {
Meters = 0,
Feet = 1
};
enum LaunchOptions {
Properties = 0,
Edit = 1,
Open = 2
};
enum View {
NorthOrEast = 0,
NorthOrWest = 1,
North = 2,
East = 3,
West = 4
};
WpjEntry(WpjBookPtr parent, QString title);
virtual ~WpjEntry() {}
const WpjBookPtr Parent;
// display name
const QString Title;
// the file name (relative to path if given)
Segment Name;
// the path of the directory in which the file is found relative to the parent
QString Path;
int Status;
// extra #units options
Segment Options;
GeoReferencePtr Reference;
bool referenceInherited() const;
GeoReferencePtr reference() const;
virtual bool isBook() const { return false; }
bool isOther() const;
bool isSurvey() const;
bool nameDefinesSegment() const;
ReviewUnits reviewUnits() const;
bool deriveDeclFromDate() const;
bool gridRelative() const;
bool preserveVertShotOrientation() const;
bool preserveVertShotLength() const;
LaunchOptions launchOptions() const;
View defaultViewAfterCompilation() const;
/**
* @return the directory where this entry's file (or this book's subentries' files)
* is located
*/
QDir dir() const;
/**
* @return the absolute path to this entry's file (or this book's directory)
*/
QString absolutePath() const;
/**
* @return the inherited and own #units options for this entry (or this book's subentries)
*/
QList<Segment> allOptions() const;
/**
* @return the starting segment for this entry
*/
QStringList segment() const;
static const int BookTypeBit;
static const int NameDefinesSegmentBit;
static const int FeetBit;
static const int ReferenceUnspecifiedBit;
static const int DontDeriveDeclBit;
static const int DeriveDeclBit;
static const int NotGridRelativeBit;
static const int GridRelativeBit;
static const int DontPreserveVertShotOrientationBit;
static const int PreserveVertShotOrientationBit;
static const int DontPreserveVertShotLengthBit;
static const int PreserveVertShotLengthBit;
static const int OtherTypeBit;
static const int EditOnLaunchBit;
static const int OpenOnLaunchBit;
static const int DefaultViewAfterCompilationMask;
static const int NorthOrEastViewBits;
static const int NorthOrWestViewBits;
static const int NorthViewBits;
static const int EastViewBits;
static const int WestViewBits;
};
///
/// \brief a book in a Walls project tree (data between .BOOK and .ENDBOOK lines)
///
class DEWALLS_LIB_EXPORT WpjBook : public WpjEntry {
public:
WpjBook(WpjBookPtr parent, QString title);
virtual ~WpjBook() {}
virtual bool isBook() const { return true; }
QList<WpjEntryPtr> Children;
};
///
/// \brief parses a Walls project file (.WPJ). You may either pass in a file
/// to parseFile() and get back a project tree, or call parseLine() yourself
/// on the lines of the file and get the project tree from result().
///
class DEWALLS_LIB_EXPORT WallsProjectParser : public QObject, public LineParser
{
Q_OBJECT
public:
WallsProjectParser(QObject* parent = 0);
void parseLine(QString line);
void parseLine(Segment line);
WpjBookPtr parseFile(QString file);
void emptyLine();
void bookLine();
void endbookLine();
void surveyLine();
void nameLine();
void refLine();
void optionsLine();
void statusLine();
void pathLine();
void commentLine();
inline WpjBookPtr result() const {
return ProjectRoot;
}
inline WpjBookPtr currentBook() const {
if (CurrentEntry.isNull()) {
return WpjBookPtr();
}
if (CurrentEntry->isBook()) {
return CurrentEntry.dynamicCast<WpjBook>();
}
return CurrentEntry->Parent;
}
signals:
void message(WallsMessage message);
private:
WpjEntryPtr CurrentEntry;
WpjBookPtr ProjectRoot;
};
} // namespace dewalls
#endif // DEWALLS_WALLSPROJECTPARSER_H
|