Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9347 in orxonox.OLD for branches/proxy/src/lib/util


Ignore:
Timestamp:
Jul 20, 2006, 11:43:27 AM (19 years ago)
Author:
bensch
Message:

orxonox/proxy: merged the proxy.old back again, and it seems to work.

Merged with command
svn merge -r9247:HEAD https://svn.orxonox.net/orxonox/branches/proxy.old .

no conflicts

Location:
branches/proxy/src/lib/util
Files:
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/util/Makefile.am

    r8724 r9347  
    66libORXlibutil_a_SOURCES = \
    77                substring.cc \
    8                 tokenizer.cc \
    98                color.cc \
    109                helper_functions.cc \
     
    3231noinst_HEADERS = \
    3332                substring.h \
    34                 tokenizer.h \
    3533                multi_type.h \
    3634                color.h \
  • branches/proxy/src/lib/util/executor/executor_functional.h

    r8271 r9347  
    179179  {
    180180    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    181       fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) );
     181      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])));
    182182  };
    183183
     
    222222  {
    223223    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    224       fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
    225       fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)));
     224      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
     225      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])));
    226226  };
    227227
     
    276276  {
    277277    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    278       fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
    279       fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),
    280       fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)));
     278      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
     279      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
     280      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])));
    281281  };
    282282
     
    333333  {
    334334    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    335       fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
    336       fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),
    337       fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)),
    338       fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)));
     335      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
     336      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
     337      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
     338      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])));
    339339  };
    340340
     
    392392  {
    393393    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    394       fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),
    395       fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),
    396       fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)),
    397       fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)),
    398       fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)));
     394      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
     395      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
     396      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
     397      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])),
     398      (sub.size() > 4) ? fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)) : (fromMulti<type4>(this->defaultValue[4])));
    399399  };
    400400
  • branches/proxy/src/lib/util/executor/functor_list.h

    r8894 r9347  
    135135
    136136  //! mixed values:
     137  FUNCTOR_LIST(2)(l_STRING, l_INT);
    137138  FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
    138139  FUNCTOR_LIST(2)(l_UINT, l_LONG);
  • branches/proxy/src/lib/util/multi_type.cc

    r8316 r9347  
    1818#include "multi_type.h"
    1919
    20 //#include "stdincl.h"
    21 #include <stddef.h>
    22 #include <stdlib.h>
    23 #include <string.h>
    24 #include <stdio.h>
    2520#include <sstream>
    2621
     
    2823#include "debug.h"
    2924#endif
    30 
    31 using namespace std;
    3225
    3326/**
  • branches/proxy/src/lib/util/substring.cc

    r7477 r9347  
    2828#include "substring.h"
    2929
    30 #include <string.h>
    31 #include <cassert>
    32 
    33 
    3430/**
    3531 * @brief default constructor
     
    108104
    109105/** @brief An empty String */
    110 const std::string SubString::emptyString = "";
     106// const std::string SubString::emptyString = "";
    111107/** @brief Helper that gets you a String consisting of all White Spaces */
    112108const std::string SubString::WhiteSpaces = " \n\t";
     
    238234  }
    239235  else
    240     return SubString::emptyString;
     236  {
     237    static std::string empty;
     238    return empty;
     239  }
    241240}
    242241
     
    250249 * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
    251250 */
    252 SubString SubString::getSubSet(unsigned int subSetBegin) const
     251SubString SubString::subSet(unsigned int subSetBegin) const
    253252{
    254253  return SubString(*this, subSetBegin);
     
    265264 * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
    266265 */
    267 SubString SubString::getSubSet(unsigned int subSetBegin, unsigned int subSetEnd) const
     266SubString SubString::subSet(unsigned int subSetBegin, unsigned int subSetEnd) const
    268267{
    269268  return SubString(*this, subSetBegin, subSetEnd);
     
    289288 * Supports delimiters, escape characters,
    290289 * ignores special  characters between safemode_char and between comment_char and linend '\n'.
    291  *
    292  *
    293290 */
    294291SubString::SPLIT_LINE_STATE
  • branches/proxy/src/lib/util/substring.h

    r8408 r9347  
    22 * @file substring.h
    33 * @brief a small class to get the parts of a string separated by commas
     4 *
     5 * This class is also identified as a Tokenizer. It splits up one long
     6 * String into multiple small ones by a designated Delimiter.
     7 *
     8 * Substring is Advanced, and it is possible, to split a string by ','
     9 * but also removing leading and trailing spaces around the comma.
     10 *
     11 * @example
     12 * Split the String std::string st = "1345, The new empire   , is , orxonox"
     13 * is splitted with:
     14 * SubString(st, ',', " \n\t")
     15 * into
     16 * "1345", "The new empire", "is", "orxonox"
     17 * As you can see, the useless spaces around ',' were removed.
    418 */
    519
    6 #ifndef _SUBSTRING_H
    7 #define _SUBSTRING_H
     20#ifndef __SUBSTRING_H__
     21#define __SUBSTRING_H__
    822
    923#include <vector>
     
    6175
    6276  // retrieve a SubSet from the String
    63   SubString getSubSet(unsigned int subSetBegin) const;
    64   SubString getSubSet(unsigned int subSetBegin, unsigned int subSetEnd) const;
     77  SubString subSet(unsigned int subSetBegin) const;
     78  SubString subSet(unsigned int subSetBegin, unsigned int subSetEnd) const;
    6579
    6680  // retrieve Information from within
     
    7084  inline unsigned int size() const { return this->strings.size(); };
    7185  /** @param i the i'th String @returns the i'th string from the subset of Strings */
    72   inline const std::string& operator[](unsigned int i) const { return (i < this->strings.size()) ? this->strings[i] : emptyString; };
     86  inline const std::string& operator[](unsigned int i) const { return this->strings[i]; };
    7387  /** @param i the i'th String @returns the i'th string from the subset of Strings */
    7488  inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
     89  /** @returns the front of the StringList. */
     90  inline const std::string& front() const { return this->strings.front(); };
     91  /** @returns the back of the StringList. */
     92  inline const std::string& back() const { return this->strings.back(); };
     93  /** @brief removes the back of the strings list. */
     94  inline void pop_back() { this->strings.pop_back(); };
    7595
    7696  // the almighty algorithm.
     
    93113private:
    94114  std::vector<std::string>  strings;                      //!< strings produced from a single string splitted in multiple strings
    95 
    96   static const std::string emptyString;
    97115};
    98116
    99 #endif /* _SUBSTRING_H */
     117#endif /* __SUBSTRING_H__ */
Note: See TracChangeset for help on using the changeset viewer.