#include <opentrep/bom/StringPartition.hpp>
Public Types | |
typedef std::list< StringSet > | StringPartition_T |
Public Member Functions | |
void | push_back (const StringSet &iStringSet) |
size_t | size () const |
bool | empty () const |
void | clear () |
const std::string & | getInitialString () const |
StringSet | calculateUniqueCombinations () const |
void | toStream (std::ostream &ioOut) const |
void | fromStream (std::istream &ioIn) |
std::string | describeKey () const |
std::string | describe () const |
StringPartition (const std::string &iStringToBePartitioned) | |
~StringPartition () | |
Public Attributes | |
std::string | _initialString |
StringPartition_T | _partition |
Class holding a string partition.
A string partition contains all the ways to combine, serially, all the words of a given string.
For instance, "rio de janeiro" will give:
Definition at line 35 of file StringPartition.hpp.
typedef std::list<StringSet> OPENTREP::StringPartition::StringPartition_T |
Type gathering all the partitions of a string.
Definition at line 40 of file StringPartition.hpp.
OPENTREP::StringPartition::StringPartition | ( | const std::string & | iStringToBePartitioned | ) |
Constructor.
const | std::string& The string for which the partitions are sought |
Definition at line 17 of file StringPartition.cpp.
OPENTREP::StringPartition::~StringPartition | ( | ) |
Default destructor.
Definition at line 23 of file StringPartition.cpp.
void OPENTREP::StringPartition::push_back | ( | const StringSet & | iStringSet | ) |
Add an item (StringSet) into the list.
Definition at line 27 of file StringPartition.cpp.
References _partition, and OPENTREP::StringSet::empty().
size_t OPENTREP::StringPartition::size | ( | ) | const |
Return the size of the list.
Definition at line 34 of file StringPartition.cpp.
References _partition.
Referenced by BOOST_AUTO_TEST_CASE().
bool OPENTREP::StringPartition::empty | ( | ) | const |
Return whether or not the list is empty.
Definition at line 39 of file StringPartition.cpp.
References _partition.
Referenced by OPENTREP::QuerySlices::push_back().
void OPENTREP::StringPartition::clear | ( | ) |
|
inline |
Get the initial string, that is, the string having been given to be partitioned.
Definition at line 70 of file StringPartition.hpp.
References _initialString.
StringSet OPENTREP::StringPartition::calculateUniqueCombinations | ( | ) | const |
Return the list of all the unique word combinations, which can be made from the partitions.
For instance, with "rio de janeiro", the list of unique strings would be:
Definition at line 171 of file StringPartition.cpp.
References _partition, OPENTREP::StringSet::_set, and OPENTREP::StringSet::push_back().
void OPENTREP::StringPartition::toStream | ( | std::ostream & | ioOut | ) | const |
Dump the structure into an output stream.
ostream& | the output stream. |
Definition at line 85 of file StringPartition.cpp.
References describe().
|
virtual |
Read a structure from an input stream.
istream& | the input stream. |
Reimplemented from OPENTREP::StructAbstract.
Definition at line 90 of file StringPartition.cpp.
std::string OPENTREP::StringPartition::describeKey | ( | ) | const |
Get a string describing the whole key (differentiating two objects at any level).
Definition at line 49 of file StringPartition.cpp.
Referenced by describe().
|
virtual |
Get the serialised version of the structure.
Implements OPENTREP::StructAbstract.
Definition at line 56 of file StringPartition.cpp.
References _partition, and describeKey().
Referenced by toStream().
std::string OPENTREP::StringPartition::_initialString |
String to be partitioned.
Definition at line 153 of file StringPartition.hpp.
Referenced by getInitialString().
StringPartition_T OPENTREP::StringPartition::_partition |
Partition, i.e., a list containing sub-lists of strings
Definition at line 158 of file StringPartition.hpp.
Referenced by calculateUniqueCombinations(), clear(), describe(), empty(), push_back(), OPENTREP::searchString(), and size().