/usr/include/odinpara/jdxblock.h is in libodin-dev 1.8.8-2ubuntu1.
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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | /***************************************************************************
jdxblock.h - description
-------------------
begin : Sun Jun 6 2004
copyright : (C) 2000-2014 by Thies H. Jochimsen
email : thies@jochimsen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef JDXBLOCK_H
#define JDXBLOCK_H
#include <tjutils/tjstatic.h>
#include <tjutils/tjlist.h>
#include <odinpara/jdxbase.h>
#include <odinpara/jdxtypes.h>
/**
* @addtogroup jcampdx
* @{
*/
typedef List<JcampDxClass,JcampDxClass*,JcampDxClass&> JDXList; // alias
/**
*
* This class represents a block of parameters. Parameters can be
* added or removed from the list of parameters within the block.
* The whole block may be written to or read from a file.
*/
class JcampDxBlock : public virtual JcampDxClass, public JDXList, public StaticHandler<JcampDxBlock> {
public:
/**
*
* Constructs an empty block of parameters with the label 'title' and the specified mode
*/
JcampDxBlock(const STD_string& title="Parameter List",compatMode mode=notBroken);
/**
*
* Copy constructor
*/
JcampDxBlock(const JcampDxBlock& block);
/**
*
* Destructor
*/
~JcampDxBlock();
/**
*
* Assignment operator
*/
JcampDxBlock& operator = (const JcampDxBlock& block);
/**
*
* Merges all parameters found in the specified 'block' into this block
*/
JcampDxBlock& merge(JcampDxBlock& block, bool onlyUserPars=true);
/**
*
* Removes all parameters found in the specified 'block' from this block
*/
JcampDxBlock& unmerge(JcampDxBlock& block);
/**
*
* Print the value of the parameter that has the label 'parameterName' as a formated string.
* If applicable, append the unit of the number in case 'append_unit' is set to 'true'.
*/
STD_string printval(const STD_string& parameterName, bool append_unit=false) const;
/**
*
* Set the value of the parameter that has the label 'parameterName' to 'value'.
* Returns 'true' if sucessful.
*/
bool parseval(const STD_string& parameterName, const STD_string& value);
/**
*
* Parse values of thius block from the string 'src' in JCAMP-DX format,
* returns the number of parameters sucessfully parsed.
*/
int parseblock(const STD_string& source);
/**
*
* Returns the current number of parameters in the block
*/
unsigned int numof_pars() const;
/**
* Returns a pointer to parameter 'label', or zero if not found
*/
JcampDxClass* get_parameter(const STD_string& ldrlabel);
/**
*
* Returns true if a parameter with the given label already exists
* in the block
*/
bool parameter_exists(const STD_string& ldrlabel) const;
/**
*
* Prefixes all parameters labels with the given string. If the prefix
* is already at the beginning of the label, it is not added again.
*/
JcampDxBlock& set_prefix(const STD_string& prefix);
/**
*
* If embedded is true, the block's widget will be displayed in a subwidget
* otherwise an 'Edit' button that will open a subdialog is generated
*/
JcampDxBlock& set_embedded(bool embedded) {embed=embedded; return *this;}
/**
*
* Returns whether the block's widget will be displayed in a subwidget
* or an 'Edit' button that will open a subdialog is generated
*/
bool is_embedded() const {return embed;}
/**
* Returns the i'th parameter in the block
*/
JcampDxClass& operator [] (unsigned int i);
/**
* Returns the const i'th parameter in the block
*/
const JcampDxClass& operator [] (unsigned int i) const;
/**
* Returns the first parameter in the block with the given 'id'
*/
JcampDxClass& get_parameter_by_id(int id);
/**
* Makes this become a copy of 'src', including its parameters by creating temporary objects.
* These temporary objects will be deleted automatically upon destruction.
*/
JcampDxBlock& create_copy(const JcampDxBlock& src);
/**
* Appends a deep copy of src (not a reference).
* This copy will be deleted automatically upon destruction.
*/
JcampDxBlock& append_copy(const JcampDxClass& src);
/**
* Copy parameter values from 'src' to the equivalent parameters in this block
*/
JcampDxBlock& copy_ldr_vals(const JcampDxBlock& src);
/**
* Compares 'rhs' with 'this' with respect to whether all parameters with
* the same label mutually exist in the other block
* and whether these parameters have the same type, label and value.
*/
bool operator == (const JcampDxBlock& rhs) const {return !( ((*this)<rhs) || ((rhs<(*this))) );}
/**
* Comparison operator which
* - (1st) compares number of parameters
* - (2nd) the type of parameters existing in both blocks
* - (3rd) the value of parameters existing in both blocks
*/
bool operator < (const JcampDxBlock& rhs) const {return compare(rhs);}
/**
* Equivalent to operator <. In addition, a list of parameters
* can be given in 'exclude' which are excluded from the comparison.
* When comparing float or double numbers, parametrs are considered equal
* if they differe by no more than the given 'accuracy'.
*/
bool compare(const JcampDxBlock& rhs, const STD_list<STD_string>* exclude=0, double accuracy=0.0) const;
#ifndef NO_CMDLINE
JcampDxBlock& parse_cmdline_options(int argc, char *argv[], bool modify=true);
STD_map<STD_string,STD_string> get_cmdline_options() const;
STD_string get_cmdline_usage(const STD_string& lineprefix="") const;
#endif
// functions for StaticHandler
static void init_static();
static void destroy_static();
// overwriting virtual functions from JcampDxClass
STD_string print() const;
JcampDxClass& set_compatmode(compatMode compat_mode);
JcampDxClass& set_parmode(parameterMode parameter_mode);
JcampDxClass& set_filemode(fileMode file_mode);
STD_string get_parx_code(parxCodeType type, const ParxEquiv& equiv=ParxEquiv()) const;
STD_ostream& print2stream(STD_ostream& os) const;
bool parsevalstring (const STD_string&) {return true;}
bool parse(STD_string& parstring);
STD_string printvalstring() const {return "";}
JcampDxClass* create_copy() const {JcampDxBlock* result=new JcampDxBlock; result->create_copy(*this); return result;}
const char* get_typeInfo() const {return "JcampDxBlock";}
JcampDxBlock* cast(JcampDxBlock*) {return this;}
int load(const STD_string &filename);
int write(const STD_string &filename) const;
STD_string get_jdx_prefix() const {return "";}
STD_string get_jdx_postfix() const {return "";}
protected:
/**
*
* Use this functions to append members of derived classes
*/
JcampDxBlock& append_member(JcampDxClass& ldr,const STD_string ldrlabel="");
private:
friend class JDXwidget;
static STD_string extract_parlabel(const STD_string& parstring);
STD_string print_header() const;
STD_string print_tail() const;
JDXList::constiter ldr_exists(const STD_string& label) const;
int parse_ldr_list(STD_string& parstring);
STD_list<JcampDxClass*>* garbage;
bool embed;
};
/** @}
*/
#endif
|