diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/public/datamodel/dmvar.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/public/datamodel/dmvar.h')
| -rw-r--r-- | mp/src/public/datamodel/dmvar.h | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/mp/src/public/datamodel/dmvar.h b/mp/src/public/datamodel/dmvar.h index c19c2896..940e138b 100644 --- a/mp/src/public/datamodel/dmvar.h +++ b/mp/src/public/datamodel/dmvar.h @@ -1,93 +1,93 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#ifndef DMVAR_H
-#define DMVAR_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-
-class CDmAttribute;
-
-//-----------------------------------------------------------------------------
-// Helper template for external attributes
-//-----------------------------------------------------------------------------
-template< typename T >
-class CDmaVar
-{
- typedef typename CDmAttributeInfo< T >::StorageType_t D;
-
-public:
- CDmaVar( );
-
- // Setup to be used in OnConstruction methods of DmElements
- void Init( CDmElement *pOwner, const char *pAttributeName, int flags = 0 );
- void InitAndSet( CDmElement *pOwner, const char *pAttributeName, const T &value, int flags = 0 );
-
- // Set/get
- const T& Set( const T &val );
- const T& Get() const;
-
- // Cast operators
- operator const T&() const;
- const T* operator->() const;
-
- // Assignment operator
- const CDmaVar<T>& operator=( const CDmaVar<T>& src );
-
- // Math utility operations
- const T& operator=( const T &val );
- const T& operator+=( const T &val );
- const T& operator-=( const T &val );
- const T& operator/=( const T &val );
- const T& operator*=( const T &val );
- const T& operator^=( const T &val );
- const T& operator|=( const T &val );
- const T& operator&=( const T &val );
- T operator++();
- T operator--();
- T operator++( int ); // postfix version..
- T operator--( int ); // postfix version..
-
- // Returns the attribute associated with the var
- CDmAttribute *GetAttribute();
- const CDmAttribute *GetAttribute() const;
-
- // Is the attribute dirty?
- bool IsDirty() const;
-
-protected:
- const T& Value() const;
- T& Value();
- const D& Storage() const;
- D& Storage();
-
-private:
- D m_Storage;
-
-protected:
- CDmAttribute *m_pAttribute;
-};
-
-//-----------------------------------------------------------------------------
-// Specialization for string
-//-----------------------------------------------------------------------------
-class CDmaString : public CDmaVar< CUtlString >
-{
-public:
- const char *Get( ) const;
- operator const char*() const;
-
- void Set( const char *pValue );
- CDmaString &operator=( const char *src );
- const CDmaString& operator=( const CDmaString& src );
-
- // Returns strlen
- int Length() const;
-};
-
-#endif // DMVAR_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#ifndef DMVAR_H +#define DMVAR_H +#ifdef _WIN32 +#pragma once +#endif + + +class CDmAttribute; + +//----------------------------------------------------------------------------- +// Helper template for external attributes +//----------------------------------------------------------------------------- +template< typename T > +class CDmaVar +{ + typedef typename CDmAttributeInfo< T >::StorageType_t D; + +public: + CDmaVar( ); + + // Setup to be used in OnConstruction methods of DmElements + void Init( CDmElement *pOwner, const char *pAttributeName, int flags = 0 ); + void InitAndSet( CDmElement *pOwner, const char *pAttributeName, const T &value, int flags = 0 ); + + // Set/get + const T& Set( const T &val ); + const T& Get() const; + + // Cast operators + operator const T&() const; + const T* operator->() const; + + // Assignment operator + const CDmaVar<T>& operator=( const CDmaVar<T>& src ); + + // Math utility operations + const T& operator=( const T &val ); + const T& operator+=( const T &val ); + const T& operator-=( const T &val ); + const T& operator/=( const T &val ); + const T& operator*=( const T &val ); + const T& operator^=( const T &val ); + const T& operator|=( const T &val ); + const T& operator&=( const T &val ); + T operator++(); + T operator--(); + T operator++( int ); // postfix version.. + T operator--( int ); // postfix version.. + + // Returns the attribute associated with the var + CDmAttribute *GetAttribute(); + const CDmAttribute *GetAttribute() const; + + // Is the attribute dirty? + bool IsDirty() const; + +protected: + const T& Value() const; + T& Value(); + const D& Storage() const; + D& Storage(); + +private: + D m_Storage; + +protected: + CDmAttribute *m_pAttribute; +}; + +//----------------------------------------------------------------------------- +// Specialization for string +//----------------------------------------------------------------------------- +class CDmaString : public CDmaVar< CUtlString > +{ +public: + const char *Get( ) const; + operator const char*() const; + + void Set( const char *pValue ); + CDmaString &operator=( const char *src ); + const CDmaString& operator=( const CDmaString& src ); + + // Returns strlen + int Length() const; +}; + +#endif // DMVAR_H |