summary refs log tree commit diff stats
path: root/generator/part.h
diff options
context:
space:
mode:
Diffstat (limited to 'generator/part.h')
-rw-r--r--generator/part.h74
1 files changed, 37 insertions, 37 deletions
diff --git a/generator/part.h b/generator/part.h index 86d5d57..b010f62 100644 --- a/generator/part.h +++ b/generator/part.h
@@ -7,7 +7,7 @@
7 7
8namespace verbly { 8namespace verbly {
9 namespace generator { 9 namespace generator {
10 10
11 class part { 11 class part {
12 public: 12 public:
13 enum class type { 13 enum class type {
@@ -19,78 +19,78 @@ namespace verbly {
19 adverb = 4, 19 adverb = 4,
20 literal = 5 20 literal = 5
21 }; 21 };
22 22
23 // Static factories 23 // Static factories
24 24
25 static part createNounPhrase(std::string role, selrestr selrestrs, std::set<std::string> synrestrs); 25 static part createNounPhrase(std::string role, selrestr selrestrs, std::set<std::string> synrestrs);
26 26
27 static part createVerb(); 27 static part createVerb();
28 28
29 static part createPreposition(std::set<std::string> choices, bool literal); 29 static part createPreposition(std::set<std::string> choices, bool literal);
30 30
31 static part createAdjective(); 31 static part createAdjective();
32 32
33 static part createAdverb(); 33 static part createAdverb();
34 34
35 static part createLiteral(std::string value); 35 static part createLiteral(std::string value);
36 36
37 // Copy and move constructors 37 // Copy and move constructors
38 38
39 part(const part& other); 39 part(const part& other);
40 40
41 part(part&& other); 41 part(part&& other);
42 42
43 // Assignment 43 // Assignment
44 44
45 part& operator=(part other); 45 part& operator=(part other);
46 46
47 // Swap 47 // Swap
48 48
49 friend void swap(part& first, part& second); 49 friend void swap(part& first, part& second);
50 50
51 // Destructor 51 // Destructor
52 52
53 ~part(); 53 ~part();
54 54
55 // General accessors 55 // General accessors
56 56
57 type getType() const 57 type getType() const
58 { 58 {
59 return type_; 59 return type_;
60 } 60 }
61 61
62 // Noun phrase accessors 62 // Noun phrase accessors
63 63
64 std::string getNounRole() const; 64 std::string getNounRole() const;
65 65
66 selrestr getNounSelrestrs() const; 66 selrestr getNounSelrestrs() const;
67 67
68 std::set<std::string> getNounSynrestrs() const; 68 std::set<std::string> getNounSynrestrs() const;
69 69
70 // Preposition accessors 70 // Preposition accessors
71 71
72 std::set<std::string> getPrepositionChoices() const; 72 std::set<std::string> getPrepositionChoices() const;
73 73
74 bool isPrepositionLiteral() const; 74 bool isPrepositionLiteral() const;
75 75
76 // Literal accessors 76 // Literal accessors
77 77
78 std::string getLiteralValue() const; 78 std::string getLiteralValue() const;
79 79
80 private: 80 private:
81 81
82 // Private constructors 82 // Private constructors
83 83
84 part() 84 part()
85 { 85 {
86 } 86 }
87 87
88 part(type t) : type_(t) 88 part(type t) : type_(t)
89 { 89 {
90 } 90 }
91 91
92 // Data 92 // Data
93 93
94 union { 94 union {
95 struct { 95 struct {
96 std::string role; 96 std::string role;
@@ -103,11 +103,11 @@ namespace verbly {
103 } preposition_; 103 } preposition_;
104 std::string literal_; 104 std::string literal_;
105 }; 105 };
106 106
107 type type_ = type::invalid; 107 type type_ = type::invalid;
108 108
109 }; 109 };
110 110
111 }; 111 };
112}; 112};
113 113