Annotation of parser3/src/types/pa_varray.C, revision 1.3
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.3 ! moko 12: volatile const char * IDENT_PA_VARRAY_C="$Id: pa_varray.C,v 1.2 2024/09/16 23:22:52 moko Exp $" IDENT_PA_VARRAY_H;
! 13:
! 14: template<typename T> void SparseArray<T>::fit(size_t index){
! 15: if(index > pa_array_limit)
! 16: throw Exception(PARSER_RUNTIME, 0, "array index %d exceeds the $MAIN:LIMITS.max_array_size (%d)", index, pa_array_limit);
! 17: Array<T>::fit(index);
! 18: }
1.1 moko 19:
20: HashStringValue& VArray::hash(){
21: if(fhash==0){
22: fhash=new HashStringValue();
23: for(ArrayValue::Iterator i(farray); i; i.next()) {
24: Value *v=i.value();
25: if(v)
26: fhash->put(i.key(), v);
27: }
28: }
29: return *fhash;
30: }
31:
32: const String* VArray::get_json_string(Json_options& options) {
33: return options.array == Json_options::A_COMPACT ? options.array_compact_json_string(&array()) :
34: options.array == Json_options::A_ARRAY ? options.array_json_string(&array()) : Value::get_json_string(options);
35: }
E-mail: