82 lines
4.3 KiB
C++
82 lines
4.3 KiB
C++
#ifndef CONSTANTS_H
|
||
#define CONSTANTS_H
|
||
#include <string>
|
||
#include <array>
|
||
#include <vector>
|
||
|
||
//static constexpr double PI = 3.1415926535897932384626433832795; // 20161010 by czb
|
||
static inline const std::string SPACE = " ";
|
||
static inline const std::string SLASH = "/";
|
||
|
||
static inline const std::string LINE_SPLITTER = "\r\n";
|
||
static inline const std::string LINE_SPLITTER_2 = ";";
|
||
static inline const std::string LINE_SPLITTER_3 = ";";
|
||
|
||
static inline const std::string WORD_SPLITTER = " ";
|
||
static inline const std::string WORD_SPLITTER_2 = ",";
|
||
static inline const std::string WORD_SPLITTER_3 = "\t";
|
||
static inline const std::string WORD_SPLITTER_4 = ",";
|
||
static inline const std::string WORD_SPLITTER_5 = ")(";
|
||
static inline const std::string WORD_SPLITTER_6 = "),(";
|
||
static inline const std::string WORD_SPLITTER_7 = "!";
|
||
static inline const std::string WORD_SPLITTER_8 = "!";
|
||
|
||
static inline const std::string EQUAL = "=";
|
||
static inline const std::string CLOSE2 = "~"; // 20161010 by czb
|
||
static inline const std::string GREATER = ">";
|
||
static inline const std::string LESS = "<";
|
||
|
||
static inline const std::array<std::string, 2> SquareBrackets = {"[", "]"};
|
||
|
||
static inline const std::string Reg_CUTIN = R"(^-?[0-9]{0,3}(\.\d{0,3})?/{0,1}$)";
|
||
static inline const std::string Reg_CUTOUT = R"(^/{0,1}-?[0-9]{0,3}(\.\d{0,3})?$)";
|
||
|
||
static inline const std::string Reg_999 = R"((^-?\d{0,2}[0-8]?|^-?[0-8]\d{0,2}|^-?9[0-8]\d?)(\.|(\.\d{0,3})?)$|^-?999(\.|(\.(99(0){0,1}|9[0-8]\d{0,1}|9|[0-8]\d{0,2}))?)$)";
|
||
static inline const std::string Reg_1000000 = R"(^-?\d{0,6}$|^-?\d{1,6}\.\d{0,3}$|^-?1000000(\.0{0,3})?$)";
|
||
|
||
static inline const std::string Reg_LONGCOORD = R"(^-?\d{0,6}$|^-?\d{1,6}\.\d{0,5}$|^-?1000000(\.0{0,5})?$|^(F|f|S|s|M|m|#|\$){1}(\+|-)?\d{1,3}$|^(F|f|S|s|M|m|#|\$){1}(\+|-)?\d{1,3}(\+|-)\d{1,5}$|^(F|f|S|s|M|m|#|\$){1}(\+|-)?\d{1,3}(\+|-)\d{1,5}\.\d{0,5}$)";
|
||
|
||
static inline const std::string Reg_LONGCOORDFULL = R"(^-?\d{1,6}$|^-?\d{1,6}\.\d{0,5}$|^#(\+|-)?\d{1,3}$|^#(\+|-)?\d{1,3}(\+|-)\d{1,4}(\.\d{0,1})?$|^\$(\+|-)?\d{1,3}(\.\d{0,3})?$|^\$(\+|-)?\d{1,3}(\.\d{0,3})?(\+|-)\d{1,6}(\.\d{0,1})?$)";
|
||
|
||
static inline const std::string Reg_2D = R"(^-?\(?\d{0,3}$|^-?\(?\d{0,3}\.?\d{0,3},?$|^-?\(?\d{0,3},$|^-?\(?\d{0,3},-?\d{0,3}$|^-?\(?\d{0,3},-?\d{0,3}\.\d{0,3}\)?$|^-?\(?\d{0,3}\.\d{0,3},-?\d{0,3}$|^-?\(?\d{0,3}\.\d{0,3},-?\d{0,3}\.\d{0,3}\)?$)";
|
||
|
||
static inline const std::string Reg_2DFULL = R"(^-?\(?\d{0,3}\.?\d{0,3},?-?\d{0,3}\.?\d{0,3}\)?$)";
|
||
|
||
static inline const std::string Reg_NAME = R"((\w*[\u4E00-\u9FA5]*)+)";
|
||
|
||
static inline const std::string Reg_LONGCOORDS = R"(^(\+|-)?\d{0,3}(\.)?\d{0,3}$|^(S|s)?(\+|-)?\d{0,3}(\.)?\d{0,3}$)";
|
||
static inline const std::string Reg_HEIGHTT = R"(^\d{0,3}(\.)?\d*(T|t)?$)";
|
||
static inline const std::string Reg_HEIGHTT1 = R"(^\d{0,3}(\.)?\d*(T|t)$)";
|
||
|
||
static inline const std::string Reg_MDECKSURF = R"(^MDECKSURF_[1-9][0-9]?$)";
|
||
static inline const std::string Reg_SHELLSURF = R"(^SHELLSURF_[1-9][0-9]?$)";
|
||
static inline const std::string Reg_HULL = R"(^HULL_[1-9][0-9]?$)";
|
||
static inline const std::string Reg_ObjName = R"(^[A-Za-z][A-Za-z0-9-_.]*$)";
|
||
|
||
// XML 节点常量
|
||
static inline const std::string XMLNODEVersion = "DataVersion";
|
||
static inline const std::string XMLNODEVersionF = "<DataVersion>";
|
||
static inline const std::string XMLNODEVersionL = "</DataVersion>";
|
||
static inline const std::string XMLNODEDATAF = "<Data>";
|
||
static inline const std::string XMLNODEDATAL = "</Data>";
|
||
static inline const std::string XMLNODEBREPF = "<OCDATA>";
|
||
static inline const std::string XMLNODEBREPL = "</OCDATA>";
|
||
|
||
const std::vector<std::string> CommandKeyWords = {
|
||
"MAINPRINCIPLE", "HULLCOORD",
|
||
"RENAME", "PROP",
|
||
"DISTANCE", "AREA", "VOLUNM",
|
||
"COPY", "TRIM", "MIRROR", "JOIN", "SPLIT", "DELETE", "INTERSECT",
|
||
"POINT",
|
||
"CURVE", "ELLIPSE", "PARABOLA",
|
||
"SURF", "LOFT", "SWEEPSURF", "ROTATIONSURF", "PIPE", "SPHERESURF",
|
||
"SOLID", "BOX", "SWEEPSOLID", "ROTATIONSOLID", "SPHERESOLID", "RTANKSOLID", "CYLINDERSOLID",
|
||
"HULL", "SPACE", "SPACEUNIT", "APPENDAGE",
|
||
"MDECKSURF", "SHELLSURF", "OPENCARGOREGION", "DECKSURF", "BOUNDSURF",
|
||
"MAT", "PLATETYPE", "BEAMTYPE", "SECTION", "SCNODE", "SCBEAM", "SCPLATE",
|
||
"SCLOOP", "SCSHELLPLATE", "SCDECKPLATE", "SCBOTTOMPLATE", "SCCHARACTPLATE", "SCSHAPELINE",
|
||
"RegenCmd", // by yangchen 20161230
|
||
"UPDATE", "REGEN" // 20170501 by czb
|
||
};
|
||
#endif // CONSTANTS_H
|