Annotation of parser3/src/types/pa_varray.C, revision 1.8
1.1 moko 1: /** @file
2: Parser: @b array class.
3:
1.8 ! moko 4: Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com)
1.1 moko 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.8 ! moko 12: volatile const char * IDENT_PA_VARRAY_C="$Id: pa_varray.C,v 1.7 2024/10/26 18:53: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()) {
1.7 moko 26: if(i.value())
27: result.put(i.key(), i.value());
1.1 moko 28: }
1.6 moko 29: return result;
1.1 moko 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: