[odb-users] Composing object view attribute

Roman Shametko shametko.roman at gmail.com
Sun Apr 12 12:05:46 EDT 2015


Hi, guys.  I need some help:

Suppose I have some class like

class AdjacencyListItem {
public:
     std::shared_ptr<AdjacencyListItem> m_parent;
     std::string m_nodeName;

     std::string nodePath() {...}
};

Which represents, for instance, file tree. Assume that class is 
persistent (not gonna write pragmas in example).
So AdjacencyListItem stores it's name and reference to it's parent, and 
nodePath glues all parent node names and produces some kind of path.

Now I want to create view containing, in addition to other members, 
"glued path" which can be prodused by nodePath method. So I need to get 
something like this

class View {
public:
     ...
      std::string m_nodePath; // path, created by 
AdjacencyListItem::nodePath
};

So my question is: Is there any way to supply Views with manually 
composed values?



More information about the odb-users mailing list