MTextFileRule.h
1 /*****************************************************************************
2 **
3 ** Header file for Muster API Text file error/warning rule
4 **
5 ** Name : MTextFileRule.h
6 ** Author : Leonardo Bernardini
7 ** Version : Alpha 9.0 Wed May 17th 2017
8 **
9 ** Copyright 2000-2017, Virtual Vertex
10 ** All Rights Reserved.
11 **
12 ** This file contains UNPUBLISHED PROPRIETARY SOURCE CODE.
13 ** The contents of this file may not be disclosed to third parties, copied
14 ** or duplicated in any form, in whole or in part, without the prior written
15 ** permission of the author.
16 **
17 *****************************************************************************/
18 #ifndef MTEXTFILERULE_H
19 #define MTEXTFILERULE_H
20 
21 #ifdef WIN32
22 // Windows definitions
23 #ifdef MCLIENTLIB_EXPORTS
24 #define MCLIENTLIB_API __declspec(dllexport)
25 #else
26 #define MCLIENTLIB_API __declspec(dllimport)
27 #endif
28 #else
29 
30 #ifndef MCLIENTLIB_EXPORTS
31 #ifdef LINUX
32 #define MCLIENTLIB_API
33 #else
34 #define MCLIENTLIB_API
35 #endif
36 #else
37 #define MCLIENTLIB_API
38 #endif
39 #endif
40 
41 #if defined(_WIN32)
42 #pragma warning(disable: 4251)
43 #endif // _WIN32
44 
45 #include <string>
46 #include <vector>
47 
48 #include "MClientLib/MTextFileMarker.h"
49 
50 namespace MClientLib {
51 
62  class MCLIENTLIB_API MTextFileRule {
63 
64  private:
65  std::string name;
66  int ruleType;
67  std::string expression;
68  int actionType;
69  int positionType;
70  int extractMode;
71  std::string marker;
72  std::string task;
73  public:
74 
78  kStringMatch = 0x00,
79  kRegExpMatch = 0x01,
80  };
81 
85  kMatchAnyPositionInLine,
86  kMustMatchAtLineBeginning
87  };
88 
92  kExtractExactString = 0x00,
93  kExtractUntilLineEnding = 0x01,
94  kExtractUntilMarker = 0x02,
95  kExtractUntilMarkerOrLineEnding = 0x03
96  };
97 
101  kRulePass = 0x00,
102  kRuleNone = 0x01,
103  kRuleError = 0x02,
104  kRuleWarning = 0x03,
105  kRuleSilenceError = 0x04,
106  kRuleSilenceWarning = 0x05,
107  };
108 
109  MTextFileRule();
110  virtual ~MTextFileRule();
111  MTextFileRule(const std::string& name, const std::string& task, int _ruleType, int _actionType, int _positionType, int _extractMode, const std::string& _expression, const std::string& _marker);
112 
113  std::string getName();
114  std::string getTask();
115  int getRuleType();
116  std::string getExpression();
117  int getActionType();
118  int getPositionType();
119  int getExtractMode();
120  std::string getMarker();
121 
122  void setName(const std::string& _name);
123  void setTask(const std::string& _task);
124  void setRuleType(int _ruleType);
125  void setExpression(const std::string& _expression);
126  void setActionType(int _actionType);
127  void setPositionType(int _positionType);
128  void setExtractMode(int _extractMode);
129  void setMarker(const std::string& _marker);
130 
131  MClientLib::MTextFileMarker ParseLine(const char* line, int lineNum);
132  static int actionToMarkerType(int actionType);
133 
135  static std::string Marshall(std::vector<MTextFileRule> list);
136  static void Unmarshall(std::vector<MTextFileRule>& list, const char* encoded);
137  static std::string Marshall(MTextFileRule& rule);
138  static bool Unmarshall(MTextFileRule& rule, const char* encoded);
141  };
142 
144 }
145 
146 #endif
lass holding a chunk data
Definition: MTextFileRule.h:62
Class holding a chunk data.