/usr/include/jaula/jaula_value.h is in libjaula-dev 1.4.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /*
* jaula_value.h : JSON Analysis User Library Acronym
* Generic values definitions
*
* Copyright (C) 2007, 2008, 2009 Kombo Morongo <morongo666@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
* svn info:
* $Author: morongo $
* $HeadURL: https://jaula.svn.sourceforge.net/svnroot/jaula/tags/jaula-1.4.0/jaula/jaula_value.h $
* $Id: jaula_value.h 45 2009-01-11 16:17:03Z morongo $
* $Revision: 45 $
*/
#ifndef _JAULA_VALUE_H_
#define _JAULA_VALUE_H_
#include <jaula/jaula_bad_data_type.h>
/**
* \addtogroup jaula_val JAULA: JSON Values containers
*/
namespace JAULA
{ // namespace JAULA
/**
* \brief Base class for handling values
*
* \ingroup jaula_val
*
* \par
* This class is the abstract base for all the containers for values
* according to the JSON specification.
*
* \author Kombo Morongo <morongo666@gmail.com>
*/
class Value
{ // class Value
public:
/**
* \brief Enumeration of available value types
*/
enum ValueType
{ // enum ValueType
/** JSON Null value */
TYPE_NULL
/** JSON Boolean value */
, TYPE_BOOLEAN
/** JSON String value */
, TYPE_STRING
/** JSON Number value */
, TYPE_NUMBER
/** JSON Number value adapted to hold integer quantities */
, TYPE_NUMBER_INT
/** JSON Array of values */
, TYPE_ARRAY
/** JSON Object */
, TYPE_OBJECT
}; // enum ValueType
/**
* \brief Destructor
*/
virtual ~Value();
/**
* \brief Retrieves the value type for the instance
*
* \note
* Value types are immutable during instance's life cycle and can only
* be specified at construction time.
*/
ValueType getType(void) const;
/**
* \brief Represents the instance in a stream
*
* \param ostr Stream where the instance is to be represented.
*
* \par Description
* writes the instance content in JSON notation in a stream.
*/
virtual void repr(std::ostream &ostr) const = 0;
/**
* \brief Copies the contents of one instance into another
*
* \param origin Reference to the value to be copied.
*
* \exception Bad_Data_Type
* This exception is launched in case that origin and destination value
* types are different.
*/
virtual void set(Value const &origin) throw(Bad_Data_Type);
/**
* \brief Assignment operator
*
* \param orig Original instance to copy
*
* \returns a reference to the destination instance
*
* \exception Bad_Data_Type
* This exception is launched in case that origin and destination value
* types are different.
*
* \par Description
* Copies the contents of the original instance in the destination.
*
* \note
* This method controls if destination and origin instances are the same
* so there is no trouble in a = a asignments.
*/
Value &operator=(Value const &orig) throw(Bad_Data_Type);
/**
* \brief Creates a duplicate of a value
*
* \param orig Original instance to duplicate.
*
* \returns a pointer to memory taken from the heap (by means of the new
* operator) and containing a deep copy of the original value.
*
* \warning
* As this method returns a pointer to memory allocated from the heap,
* it is up to the caller to release once it is no longer needed in
* order to avoid leaks.
*/
static Value *duplicate(Value const &orig);
protected:
/**
* \brief Constructor
*
* \param Type Type of value to be contained by the instance
*
* \par Description
* This method construct a new instance by specifying its type.
*
* \note
* A ValueType for the instance is immutable during all the life cycle,
* this is the only method that permits specifying the value type.
*/
Value(ValueType Type);
private:
/**
* \brief Container for error code
*/
ValueType Type_;
}; // class Value
} // namespace JAULA
/**
* \brief Insertion operator extension for values
*
* \ingroup jaula_val
*
* \param ostr Stream where the instance is to be represented.
*
* \param val Instance to represent
*
* \returns a reference to the stream
*
* \par Description
* This method extends the standard insertion operation for streams to invoke
* JAULA::repr() through this alternative sintax writing the contents in JSON
* notation.
*
* \author Kombo Morongo <morongo666@gmail.com>
*/
std::ostream &operator<<(std::ostream &ostr, JAULA::Value const &val);
#endif
// EOF $Id: jaula_value.h 45 2009-01-11 16:17:03Z morongo $
|