/*
 * String.h
 *
 *  Created on: Apr 10, 2013
 *      Author: Jan Travnicek
 */

#pragma once

#include <alib/set>
#include <alib/vector>

#include <common/DefaultSymbolType.h>

#include "LinearString.h"

namespace {

template < class SymbolType >
static string::LinearString < > normalizeLinearString ( const string::LinearString < SymbolType > & str ) {
    return core::normalize < string::LinearString < SymbolType > >::eval(str);
}

} /* namespace */

namespace string {

/**
 * Wrapper around strings.
 */
class String;

template < class SymbolType >
string::LinearString < SymbolType > stringFrom ( const SymbolType & symbol ) {
	return string::String { string::LinearString < SymbolType > { ext::vector < SymbolType > { symbol } } };
}

string::LinearString < char > stringFrom ( const std::string & string );

string::LinearString < char > stringFrom ( const char * string );

template < class SymbolType >
string::LinearString < SymbolType > stringFrom ( const ext::vector < SymbolType > & str ) {
	return string::LinearString < SymbolType > { str };
}

template < class SymbolType >
string::LinearString < SymbolType > stringFrom ( const string::LinearString < SymbolType > & str ) {
    return str;
}

template < class T >
string::LinearString < > normalizedStringFrom ( const T & data ) {
    return normalizeLinearString(stringFrom(data));
}

} /* namespace string */

