Annotation of parser3/src/types/pa_varray.C, revision 1.6
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.6 ! moko 12: volatile const char * IDENT_PA_VARRAY_C="$Id: pa_varray.C,v 1.5 2024/10/20 13:29:37 moko Exp $" IDENT_PA_VARRAY_H;
1.4 moko 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){
1.5 moko 18: if(index > (size_t)pa_array_limit)
1.3 moko 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(){
1.6 ! moko 24: HashStringValue& result=*new HashStringValue();
! 25: for(ArrayValue::Iterator i(farray); i; i.next()) {
! 26: Value *v=i.value();
! 27: if(v)
! 28: result.put(i.key(), v);
1.1 moko 29: }
1.6 ! moko 30: return result;
1.1 moko 31: }
32:
33: const String* VArray::get_json_string(Json_options& options) {
34: return options.array == Json_options::A_COMPACT ? options.array_compact_json_string(&array()) :
35: options.array == Json_options::A_ARRAY ? options.array_json_string(&array()) : Value::get_json_string(options);
36: }
E-mail: