1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2008 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at
8 // your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #ifndef FMTGEN_TYPE_STRING_INTROSP_CODE_H
20 #define FMTGEN_TYPE_STRING_INTROSP_CODE_H
21 
22 #include <fmtgen/type/string.h>
23 
24 /**
25   * The type_string_introspector_code class is used to represent the
26   * code generation needed to manage strings in the meta-data, in the
27   * C++ OO introspector style, for the code files.
28   */
29 class type_string_introspector_code:
30     public type_string
31 {
32 public:
33     /**
34       * The destructor.
35       */
36     virtual ~type_string_introspector_code();
37 
38 private:
39     /**
40       * The constructor.
41       * It is private on purpose, use the #create class method instead.
42       *
43       * @param gen
44       *     where to write the generated code
45       */
46     type_string_introspector_code(generator *gen);
47 
48 public:
49     /**
50       * The create class method is used to create new dynamically
51       * allocated instances of this class.
52       *
53       * @param gen
54       *     where to write the generated code
55       */
56     static pointer create(generator *gen);
57 
58 protected:
59     // See base class for documentation.
60     void gen_body() const;
61 
62     // See base class for documentation.
63     void gen_declarator(const nstring &variable_name, bool is_a_list,
64         int attributes, const nstring &comment) const;
65 
66     // See base class for documentation.
67     void gen_call_xml(const nstring &form_name, const nstring &member_name,
68         int attributes) const;
69 
70     // See base class for documentation.
71     void gen_copy(const nstring &member_name) const;
72 
73     // See base class for documentation.
74     void gen_trace(const nstring &name, const nstring &value) const;
75 
76     // See base class for documentation.
77     void gen_free_declarator(const nstring &variable_name, bool is_a_list)
78         const;
79 
80     // See base class for documentation.
81     void gen_default_constructor(const nstring &inst_var_name);
82 
83     // See base class for documentation.
84     void gen_methods(const nstring &class_name, const nstring &inst_var_name,
85         int attributes) const;
86 
87     // See base class for documentation.
88     void gen_write(const nstring &form_name, const nstring &member_name,
89         bool show_default) const;
90 
91 private:
92     /**
93       * The default constructor.  Do not use.
94       */
95     type_string_introspector_code();
96 
97     /**
98       * The copy constructor.  Do not use.
99       */
100     type_string_introspector_code(const type_string_introspector_code &);
101 
102     /**
103       * The assignment operator.  Do not use.
104       */
105     type_string_introspector_code &operator=(
106         const type_string_introspector_code &);
107 };
108 
109 #endif // FMTGEN_TYPE_STRING_INTROSP_CODE_H
110