Tulip  5.0.0
Large graphs analysis and drawing
StringProperty.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 #ifndef TULIP_STRING_H
21 #define TULIP_STRING_H
22 
23 #include <tulip/PropertyTypes.h>
24 #include <tulip/AbstractProperty.h>
25 
26 namespace tlp {
27 
28 class PropertyContext;
29 
30 typedef AbstractProperty<tlp::StringType, tlp::StringType> AbstractStringProperty;
31 
32 /**
33  * @ingroup Graph
34  * @brief A graph property that maps a std::string value to graph elements.
35  */
36 class TLP_SCOPE StringProperty:public AbstractStringProperty {
37 public :
38  StringProperty (Graph *g, const std::string& n="");
39 
40  // redefinition of some PropertyInterface methods
41  PropertyInterface* clonePrototype(Graph *, const std::string&) const;
42  static const std::string propertyTypename;
43  const std::string& getTypename() const {
44  return propertyTypename;
45  }
46  // the value size of a StringVectorProperty is not fixed
47  virtual unsigned int nodeValueSize() const {
48  return 0;
49  }
50  virtual unsigned int edgeValueSize() const {
51  return 0;
52  }
53  int compare(const node n1,const node n2)const;
54  int compare(const edge e1,const edge e2)const;
55 };
56 
57 /**
58  * @ingroup Graph
59  * @brief A graph property that maps a std::vector<std::string> value to graph elements.
60  */
61 class TLP_SCOPE StringVectorProperty:public AbstractVectorProperty<tlp::StringVectorType, tlp::StringType> {
62 public :
63  StringVectorProperty(Graph *g, const std::string& n=""):AbstractVectorProperty<StringVectorType, tlp::StringType>(g, n) {}
64 
65  // redefinition of some PropertyInterface methods
66  PropertyInterface* clonePrototype(Graph *, const std::string&) const;
67  static const std::string propertyTypename;
68  const std::string& getTypename() const {
69  return propertyTypename;
70  }
71  // the value size of a StringVectorProperty is not fixed
72  virtual unsigned int nodeValueSize() const {
73  return 0;
74  }
75  virtual unsigned int edgeValueSize() const {
76  return 0;
77  }
78 };
79 /*\@}*/
80 }
81 #endif
PropertyInterface describes the interface of a graph property.
A graph property that maps a std::vector<std::string> value to graph elements.
The edge struct represents an edge in a Graph object.
Definition: Edge.h:39
The node struct represents a node in a Graph object.
Definition: Node.h:39
A graph property that maps a std::string value to graph elements.