1 /* src/toolbox/sequence.hpp - sequence builder class header
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 Copyright (C) 2009 Theobroma Systems Ltd.
7 This file is part of CACAO.
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2, or (at
12 your option) any later version.
14 This program is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
36 * This class is a mutable and dynamically growing character sequence.
37 * Its main purpose is to dynamically construct Strings or Symbols which
40 * The buffer backing up this class is automatically (re)allocated as the
41 * sequence grows, no additional length checks are required. Furthermore
42 * the buffer memory is released once the builder is destructed and it's
43 * content is destroyed. To preserve the content, it has to be exported
44 * with one of the exporting functions.
46 class SequenceBuilder {
54 // Concatenation operations.
55 void cat(char ch) { _str.push_back(ch); }
56 void cat(char ch, int n) { _str.append(n, ch); }
57 void cat(const char* s) { _str.append(s); }
59 // Exporting functions.
60 //Object* export_string();
61 //Symbol* export_symbol();
63 // Be careful and see std::string::c_str() for details.
64 const char* c_str() const { return _str.c_str(); }
68 #endif // _SEQUENCE_HPP
72 * These are local overrides for various environment variables in Emacs.
73 * Please do not remove this and leave it at the end of the file, where
74 * Emacs will automagically detect them.
75 * ---------------------------------------------------------------------
82 * vim:noexpandtab:sw=4:ts=4: