Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 21, 2008, 9:23:11 PM (16 years ago)
Author:
rgrieder
Message:
  • Finished CommandLineArgument completely. You can also use SetCommandLineSwitch to define boolean switches.
  • Added StaticConversion to Covert.h (compile time type conversion checking)
  • Fixed a bug in Exception
  • Added getAllStrings() to SubString
Location:
code/branches/gui/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/util/Convert.h

    r1625 r1664  
    690690};
    691691
     692
     693///////////////////////////
     694// Static type detection //
     695///////////////////////////
     696
     697/**
     698    Template class that determines whether type T converts implicitly to type U.
     699@note
     700    This allows to detect type conversion at compile time.
     701    From 'Modern C++ Design' (Alexandrescu 2001).
     702*/
     703template <class T, class U>
     704class StaticConversion
     705{
     706    class Small { char dummy[1]; };
     707    class Big   { char dummy[1024]; };
     708    static Small Test(U);
     709    static Big   Test(...);
     710    static T MakeT();
     711public:
     712    enum { exists = sizeof(Test(MakeT())) == sizeof(Small) };
     713};
     714
    692715#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
    693716#pragma warning(pop)
  • code/branches/gui/src/util/SubString.h

    r1505 r1664  
    131131  /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */
    132132  inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
     133  /** @brief Returns all Strings as std::vector */
     134  inline const std::vector<std::string>& getAllStrings() const { return this->strings; }
    133135  /** @brief Returns true if the token is in safemode. @param i the i'th token */
    134136  inline bool isInSafemode(unsigned int i) const { return this->bInSafemode[i]; }
Note: See TracChangeset for help on using the changeset viewer.