OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Names.hpp
Go to the documentation of this file.
1 #ifndef __OPENTREP_NAMES_HPP
2 #define __OPENTREP_NAMES_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 #include <string>
10 #include <list>
11 #include <map>
12 // OpenTrep
15 
16 namespace OPENTREP {
17 
18 
19  // ////////////////// Type definitions ///////////////////
20  typedef std::list<std::string> NameList_T;
21 
26  struct Names : public OPENTREP_Abstract {
27  public:
28  // //// Constructors / Destructors ///////
32  Names (const LanguageCode_T&);
36  Names (const Names&);
40  ~Names();
41  private:
45  Names();
46 
47 
48  public:
49  // /////////// Getters ///////////////
54  return _languageCode;
55  }
56 
60  const NameList_T& getNameList() const {
61  return _nameList;
62  }
63 
69  std::string getFirstName() const;
70 
71 
72  public:
73  // /////////// Setters ///////////////
77  void setLanguageCode (const LanguageCode_T& iLanguageCode) {
78  _languageCode = iLanguageCode;
79  }
80 
84  void addName (const std::string& iName);
85 
89  void resetList();
90 
91 
92  public:
93  // /////////// Display support methods /////////
99  void toStream (std::ostream& ioOut) const;
100 
106  void fromStream (std::istream& ioIn);
107 
111  std::string toString() const;
112 
118  std::string describeKey() const;
119 
125  std::string describe() const;
126 
127 
128  private:
129  // //////////// Attributes //////////////
133  LanguageCode_T _languageCode;
134 
138  NameList_T _nameList;
139  };
140 
141  // ////////////// Type definitions ////////////
149  typedef std::map<LanguageCode_T, Names> NameMatrix_T;
150 
151 }
152 #endif // __OPENTREP_NAMES_HPP
void setLanguageCode(const LanguageCode_T &iLanguageCode)
Definition: Names.hpp:77
std::string toString() const
Definition: Names.cpp:82
std::list< std::string > NameList_T
Definition: Names.hpp:20
void fromStream(std::istream &ioIn)
Definition: Names.cpp:78
void addName(const std::string &iName)
Definition: Names.cpp:89
std::string getFirstName() const
Definition: Names.cpp:33
const NameList_T & getNameList() const
Definition: Names.hpp:60
std::string describe() const
Definition: Names.cpp:51
std::map< LanguageCode_T, Names > NameMatrix_T
Definition: Names.hpp:149
void toStream(std::ostream &ioOut) const
Definition: Names.cpp:73
LanguageCode_T getLanguageCode() const
Definition: Names.hpp:53
std::string describeKey() const
Definition: Names.cpp:44
void resetList()
Definition: Names.cpp:94