Rudiments
arraycollectioninlines.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information.
3
4#include <rudiments/private/new.h>
5
6template< class valuetype >
7inline
9 return "array";
10}
11
12template< class valuetype >
13inline
15 return write(&stdoutput);
16}
17
18template< class valuetype >
19inline
21 return writeJson(out,true);
22}
23
24template< class valuetype >
25inline
27 return writeJson(&stdoutput,true);
28}
29
30template< class valuetype >
31inline
33 return writeJson(&stdoutput,indent);
34}
35
36template< class valuetype >
37inline
39 return writeJson(out,true);
40}
41
42template< class valuetype >
43inline
45 ssize_t retval=0;
46 incOrErr(&retval,out->write('['),1);
47 for (uint64_t i=0; i<getCount() && retval>-1; i++) {
48 ((i)?this->incOrErr(&retval,out->write(','),1):true) &&
49 ((indent)?this->incOrErr(&retval,out->write("\n ",2),2):true) &&
50 incOrErr(&retval,this->writeJsonValue(out,(*this)[i]));
51 }
52 ((indent)?incOrErr(&retval,out->write('\n'),1):true) &&
53 incOrErr(&retval,out->write(']'),1) &&
54 ((indent)?incOrErr(&retval,out->write('\n'),1):true);
55 return retval;
56}
virtual ssize_t write()
Definition arraycollectioninlines.h:14
virtual const char * getType()
Definition arraycollectioninlines.h:8
virtual ssize_t writeJson()
Definition arraycollectioninlines.h:26
Definition output.h:11
virtual ssize_t write(const byte_t *string, size_t size)=0