Annotation of parser3/src/types/pa_vstring.C, revision 1.18
1.1 paf 1: /** @file
1.5 paf 2: Parser: @b string class.
1.1 paf 3:
1.17 paf 4: Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.16 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 6:
1.18 ! paf 7: $Id: pa_vstring.C,v 1.17 2002/02/08 08:32:35 paf Exp $
1.1 paf 8: */
9:
10: #include "pa_vstring.h"
11: #include "pa_vfile.h"
12:
1.9 parser 13: VFile *VString::as_vfile(String::Untaint_lang lang,
14: bool origins_mode) {
1.1 paf 15: VFile& result=*NEW VFile(pool());
1.14 paf 16: const char *cstr=origins_mode?fstring->cstr_debug_origins():fstring->cstr(lang);
1.4 paf 17: result.set(false/*not tainted*/, cstr, strlen(cstr));
1.1 paf 18: return &result;
1.8 parser 19: }
1.18 ! paf 20:
! 21: const String& VString::optimized_string(bool suppressed_until_forced, char** cstr, bool forced) {
! 22: const String& before=string();
! 23: if(forced
! 24: || !suppressed_until_forced && before.is_join_chains_profitable()) {
! 25: const String& after=before.join_chains(pool(), cstr);
! 26: set_string(after);
! 27: return after;
! 28: } else {
! 29: // optimization may be considered unprofitable,
! 30: // should indicate that we could not make cstr
! 31: if(cstr)
! 32: *cstr=0;
! 33:
! 34: return before;
! 35: }
! 36: }
E-mail: