Annotation of parser3/src/types/pa_varray.C, revision 1.4
1.1 moko 1: /** @file
2: Parser: @b array class.
3:
4: Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com)
5: Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
6: */
7:
8: #include "pa_varray.h"
9: #include "pa_vfile.h"
1.3 moko 10: #include "pa_request.h"
1.1 moko 11:
1.4 ! moko 12: volatile const char * IDENT_PA_VARRAY_C="$Id: pa_varray.C,v 1.3 2024/09/22 13:56:09 moko Exp $" IDENT_PA_VARRAY_H;
! 13:
! 14: // Explicit instantiation for Visual Studio
! 15: template class SparseArray<Value*>;
1.3 moko 16:
17: template<typename T> void SparseArray<T>::fit(size_t index){
18: if(index > pa_array_limit)
19: throw Exception(PARSER_RUNTIME, 0, "array index %d exceeds the $MAIN:LIMITS.max_array_size (%d)", index, pa_array_limit);
20: Array<T>::fit(index);
21: }
1.1 moko 22:
23: HashStringValue& VArray::hash(){
24: if(fhash==0){
25: fhash=new HashStringValue();
26: for(ArrayValue::Iterator i(farray); i; i.next()) {
27: Value *v=i.value();
28: if(v)
29: fhash->put(i.key(), v);
30: }
31: }
32: return *fhash;
33: }
34:
35: const String* VArray::get_json_string(Json_options& options) {
36: return options.array == Json_options::A_COMPACT ? options.array_compact_json_string(&array()) :
37: options.array == Json_options::A_ARRAY ? options.array_json_string(&array()) : Value::get_json_string(options);
38: }
E-mail: