9 #ifndef __DIADES__UTILS__LABEL__HH 10 #define __DIADES__UTILS__LABEL__HH 31 template <
typename CharT,
52 return _label.empty();
80 template <
typename CharT,
typename Traits,
typename Alloc >
118 while(std::isspace<CharT>(c, is.getloc()) && is.get(c))
125 is.seekg(-counter, std::ios_base::cur);
131 while(!(stop) && is.get(c))
144 if(label.size() == 1)
146 is.seekg(-counter, std::ios_base::cur);
149 if(label.back() !=
'\"')
151 is.seekg(-counter, std::ios_base::cur);
160 template<
typename CharT,
typename Traits,
typename Alloc>
172 template <
typename CharT,
typename Traits,
typename Alloc >
188 checkUnquotedLabel(s);
193 checkUnquotedLabel(is);
207 if(std::find_if(s.begin(), s.end(), [&](CharT c) ->
bool 213 std::basic_stringstream<CharT> stream;
216 checkUnquotedLabel(stream);
228 while(std::isspace<CharT>(c, is.getloc()) && is.get(c))
234 if(!(std::isalpha(c) || c ==
'_'))
237 is.seekg(-counter, std::ios_base::cur);
244 while(!(stop) && is.get(c))
247 if(std::isalnum<CharT>(c, is.getloc()) || (c ==
'_'))
253 if(std::isspace<CharT>(c, is.getloc()))
256 is.seekg(-1, std::ios_base::cur);
260 is.seekg(-counter, std::ios_base::cur);
275 template <
typename CharT,
280 std::basic_string<CharT, Traits, Alloc> & label)
343 template<
typename CharT,
typename Traits,
typename Alloc>
353 const std::array<CharT, 26>
354 _characters = {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z'};
412 _enumerator.
setup({0},
425 Label result = getLabel();
428 std::vector<size_t>
start(_enumerator.
current().size() + 1);
429 std::vector<size_t> last(_enumerator.
current().size() + 1);
431 std::fill(last.begin(), last.end(), _characters.size());
432 _enumerator.
setup(std::move(
start), std::move(last));
448 std::for_each(_enumerator.
current().rbegin(), _enumerator.
current().rend(),
451 configuration += _characters[i];
std::basic_string< CharT, Traits, Alloc > BasicString
void checkUnquotedLabel(const BasicString &s)
QuotedLabel & operator=(const QuotedLabel &label)
Diades::Utils::RangesEnumeration< size_t > _enumerator
QuotedLabel< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > QuotedWideStringLabel
UnquotedLabel< char, std::char_traits< char >, std::allocator< char > > UnquotedStringLabel
LabelGenerator< char, std::char_traits< char >, std::allocator< char > > UnquotedStringLabelGenerator
QuotedLabel(std::basic_istream< CharT > &is)
UnquotedLabel(std::basic_istream< CharT > &is)
const BasicString & toString() const
LabelGenerator< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > UnquotedWideStringLabelGenerator
UnquotedLabel & operator=(const UnquotedLabel &label)
LabelGenerator(const Label &prefix)
GenericLabel & operator=(const GenericLabel &label)
bool readLabel(std::basic_istream< CharT > &stream, std::basic_string< CharT, Traits, Alloc > &label)
QuotedLabel< char, std::char_traits< char >, std::allocator< char > > QuotedStringLabel
Namespace of the Diades project.
void setup(std::vector< T > &&start, const std::vector< T > &&end)
GenericLabel< CharT, Traits, Alloc >::BasicString nudeString() const
UnquotedLabel(const BasicString &s)
void checkUnquotedLabel(std::basic_istream< CharT > &is)
UnquotedLabel< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > UnquotedWideStringLabel
void checkQuotedLabel(std::basic_istream< CharT > &is)
const std::vector< T > & current() const
void setLabel(const BasicString &label)
typename GL::BasicString BasicString