Annotation of parser3/src/types/pa_vstring.C, revision 1.40
1.1 paf 1: /** @file
1.5 paf 2: Parser: @b string class.
1.1 paf 3:
1.39 moko 4: Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com)
1.38 moko 5: Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.20 paf 6: */
1.1 paf 7:
8: #include "pa_vstring.h"
9: #include "pa_vfile.h"
10:
1.40 ! moko 11: volatile const char * IDENT_PA_VSTRING_C="$Id: pa_vstring.C,v 1.39 2024/11/04 03:53:26 moko Exp $" IDENT_PA_VSTRING_H;
1.28 moko 12:
1.23 paf 13: VFile* VString::as_vfile(String::Language lang, const Request_charsets* charsets) {
14: VFile& result=*new VFile;
1.27 misha 15: String::Body sbody=fstring->cstr_to_string_body_untaint(lang, 0, charsets);
1.33 moko 16: /* we are using binary to avoid ^#0D to be altered */
1.34 moko 17: result.set_binary_string(false/*not tainted*/, sbody.cstr() , sbody.length());
1.1 paf 18: return &result;
1.8 parser 19: }
1.40 ! moko 20:
! 21: VString* VString::uitoa(size_t aindex) {
! 22: static const size_t CACHE_SIZE=256;
! 23: static VString* cache[CACHE_SIZE];
! 24: if (aindex < CACHE_SIZE)
! 25: return !cache[aindex] ? ( cache[aindex]=new VString(*new String(pa_uitoa(aindex))) ) : cache[aindex];
! 26: else
! 27: return new VString(*new String(pa_uitoa(aindex)));
! 28: }
E-mail: