libgexf  0.1.3
conv.h
Go to the documentation of this file.
1 
7 /*
8 # Copyright (c) <2009> <Sebastien Heymann>
9 #
10 # Permission is hereby granted, free of charge, to any person obtaining a copy
11 # of this software and associated documentation files (the "Software"), to deal
12 # in the Software without restriction, including without limitation the rights
13 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 # copies of the Software, and to permit persons to whom the Software is
15 # furnished to do so, subject to the following conditions:
16 #
17 # The above copyright notice and this permission notice shall be included in
18 # all copies or substantial portions of the Software.
19 #
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 # THE SOFTWARE.
27 */
28 
29 #ifndef _CONV_H
30 #define _CONV_H
31 
32 #include "typedefs.h"
33 #include "data.h"
34 #include "gexfparser.h"
35 #include <string>
36 #include <set>
37 #include <libxml/xmlstring.h>
38 
39 namespace libgexf {
40 
41  class Data;
42  class GexfParser;
43 
47  class Conv {
48  public:
49  Conv();
50  Conv(const Conv& orig);
51  virtual ~Conv();
52 
53  static libgexf::t_id xmlCharToId(const xmlChar* str);
54  static libgexf::t_id strToId(const std::string& str);
55  static std::string xmlCharToStr(const xmlChar* str);
56  static unsigned int xmlCharToUnsignedInt(const xmlChar* str);
57  static float xmlCharToFloat(const xmlChar* str);
58  static std::string idToStr(const libgexf::t_id id);
59  static std::string unsignedIntToStr(const unsigned int i);
60  static std::string floatToStr(const float f);
61  static unsigned int strToUnsignedInt(const std::string& str);
62  static std::string edgeTypeToStr(const libgexf::t_edge_type t);
63  static std::string attrTypeToStr(const libgexf::t_attr_type t);
64  static bool isBoolean(const std::string& str);
65  static bool isDouble(const std::string& str);
66  static bool isInteger(const std::string& str);
67  static bool isFloat(const std::string& str);
68  static bool isLong(const std::string& str);
69  static bool isAnyURI(const std::string& str);
70  static std::set<std::string> tokenizer(const std::string& delimiter, const std::string& str);
71  private:
72  virtual void iAmAbstract() = 0;
73 
74  /*static libgexf::t_edge_type strToEdgeType(const std::string& str);*/
75  static libgexf::t_attr_type strToAttrType(const std::string& str);
76  friend class Data;
77  friend class GexfParser;
78  };
79 
80 } /* namespace libgexf */
81 
82 #endif /* _CONV_H */
83 
std::string t_id
Definition: typedefs.h:35
Definition: abstractiter.h:32
t_edge_type
Available edge types.
Definition: typedefs.h:50
Parse a GEXF file.
Definition: gexfparser.h:45
t_attr_type
Available types of attributes.
Definition: typedefs.h:55
Associated data and attributes on nodes and edges.
Definition: data.h:47
Utility static class for transforming data.
Definition: conv.h:47