49 boost::container::static_vector<const std::string*, 16> strings_chain;
53 const auto& str = leaf_node->
value();
54 strings_chain.push_back( &str );
55 leaf_node = leaf_node->
parent();
58 std::reverse(strings_chain.begin(), strings_chain.end() );
60 size_t array_count = 0;
63 for(
const auto& str: strings_chain)
65 const size_t S = str->size();
66 if( S == 1 && (*str)[0] ==
'#' )
68 buffer[offset++] =
'.';
72 if( str != strings_chain.front() ){
73 buffer[offset++] =
'/';
75 std::memcpy( &buffer[offset], str->data(), S );
79 buffer[offset] =
'\0';
92 boost::container::static_vector<const std::string*, 16> strings_chain;
94 size_t total_size = 0;
98 const auto& str = leaf_node->
value();
99 leaf_node = leaf_node->
parent();
100 if( !( leaf_node ==
nullptr && skip_root) )
102 strings_chain.emplace_back( &str );
103 const size_t S = str.size();
104 if( S == 1 && str[0] ==
'#' )
114 out.resize(total_size);
115 char* buffer = &out[0];
117 std::reverse(strings_chain.begin(), strings_chain.end() );
119 size_t array_count = 0;
122 for(
const auto& str: strings_chain)
124 const size_t S = str->size();
125 if( S == 1 && (*str)[0] ==
'#' )
127 buffer[offset++] =
'.';
131 if( str != strings_chain.front() ){
132 buffer[offset++] =
'/';
134 std::memcpy( &buffer[offset], str->data(), S );
int print_number(char *buffer, uint16_t value)
The StringTreeLeaf is, as the name suggests, a leaf (terminal node) of a StringTree. It provides the pointer to the node and a list of numbers that represent the index that corresponds to the placeholder "#".
Element of the tree. it has a single parent and N >= 0 children.
const TreeNode * parent() const
void CreateStringFromTreeLeaf(const StringTreeLeaf &leaf, bool skip_root, std::string &out)
boost::container::static_vector< uint16_t, 8 > index_array
const StringTreeNode * node_ptr
bool toStr(std::string &destination) const
Utility functions to print the entire branch.