INET Framework for OMNeT++/OMNEST
inet::visualizer::StringFormat Class Reference

#include <StringFormat.h>

Classes

class  IDirectiveResolver
 

Public Member Functions

void parseFormat (const char *format)
 
const char * formatString (IDirectiveResolver *resolver) const
 

Protected Attributes

std::string format
 
std::string result
 

Member Function Documentation

const char * inet::visualizer::StringFormat::formatString ( IDirectiveResolver resolver) const

Referenced by inet::visualizer::InfoVisualizerBase::getInfoVisualizationText(), inet::visualizer::LinkVisualizerBase::getLinkVisualizationText(), inet::visualizer::PathVisualizerBase::getPathVisualizationText(), inet::visualizer::RoutingTableVisualizerBase::getRouteVisualizationText(), inet::visualizer::StatisticVisualizerBase::getText(), and inet::visualizer::InterfaceTableVisualizerBase::getVisualizationText().

30 {
31  result.clear();
32  int current = 0;
33  int previous = current;
34  while (true) {
35  char ch = format[current];
36  if (ch == '\0') {
37  if (previous != current)
38  result.append(format.begin() + previous, format.begin() + current);
39  break;
40  }
41  else if (ch == '%') {
42  if (previous != current)
43  result.append(format.begin() + previous, format.begin() + current);
44  previous = current;
45  current++;
46  ch = format[current];
47  if (ch == '%')
48  result.append(format.begin() + previous, format.begin() + current);
49  else
50  result.append(directiveResolver->resolveDirective(ch));
51  previous = current + 1;
52  }
53  current++;
54  }
55  return result.c_str();
56 }
std::string result
Definition: StringFormat.h:38
std::string format
Definition: StringFormat.h:37

Member Data Documentation

std::string inet::visualizer::StringFormat::format
protected

Referenced by formatString(), and parseFormat().

std::string inet::visualizer::StringFormat::result
mutableprotected

Referenced by formatString().


The documentation for this class was generated from the following files: