Skip to content
Snippets Groups Projects
Commit 73e75c48 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

better linear and cyclic string constr from string

parent 7ecefe24
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,6 @@
#include "StringFeatures.h"
#include "common/StringFromXMLParser.h"
#include "common/StringToXMLComposer.h"
#include "common/StringAuxiliary.h"
#include <exception/CommonException.h>
#include <alphabet/common/SymbolNormalize.h>
 
......@@ -122,7 +121,7 @@ CyclicString < SymbolType >::CyclicString(std::vector<SymbolType> str) : CyclicS
}
 
template < class SymbolType >
CyclicString < SymbolType >::CyclicString(const std::string& str) : CyclicString ( StringAuxiliary::toInternal ( str ) ) {
CyclicString < SymbolType >::CyclicString(const std::string& str) : CyclicString ( std::vector < SymbolType > ( str.begin ( ), str.end ( ) ) ) {
}
 
template < class SymbolType >
......
......@@ -21,7 +21,6 @@
#include "StringFeatures.h"
#include "common/StringFromXMLParser.h"
#include "common/StringToXMLComposer.h"
#include "common/StringAuxiliary.h"
#include <exception/CommonException.h>
#include <alphabet/common/SymbolNormalize.h>
 
......@@ -150,7 +149,7 @@ LinearString < SymbolType >::LinearString(std::vector<SymbolType> str) : LinearS
}
 
template < class SymbolType >
LinearString < SymbolType >::LinearString(const std::string & str) : LinearString ( StringAuxiliary::toInternal ( str ) ) {
LinearString < SymbolType >::LinearString(const std::string & str) : LinearString ( std::vector < SymbolType > ( str.begin ( ), str.end ( ) ) ) {
}
 
template < class SymbolType >
......
/*
* StringAuxiliary.cpp
*
* Created on: May 7, 2016
* Author: Jan Travnicek
*/
#include "StringAuxiliary.h"
namespace string {
std::vector < DefaultSymbolType > StringAuxiliary::toInternal ( const std::string & rawString ) {
std::vector < DefaultSymbolType > data;
for ( const char& symbol : rawString ) {
data.push_back( DefaultSymbolType ( symbol ) );
}
return data;
}
} /* namespace string */
/*
* StringAuxiliary.h
*
* Created on: May 7, 2016
* Author: Jan Travnicek
*/
#ifndef STRING_AUXILIARY_H_
#define STRING_AUXILIARY_H_
#include <set>
#include <vector>
#include <common/DefaultSymbolType.h>
namespace string {
/**
* Parser used to get string from XML parsed into list of Tokens.
*/
class StringAuxiliary {
public:
static std::vector < DefaultSymbolType > toInternal ( const std::string & rawString );
};
} /* namespace string */
#endif /* STRING_AUXILIARY_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment