Added missing files

This commit is contained in:
Kernell 2016-01-06 21:08:32 +03:00
parent 164310084c
commit 36daf9dd68
2 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,85 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "StdInc.h"
#include "CMonoArguments.h"
CMonoArguments::CMonoArguments( void )
{
this->m_pTmpArgs = nullptr;
}
CMonoArguments::~CMonoArguments( void )
{
for( auto iter : this->m_pArgs )
{
if( iter.second )
{
delete iter.first;
}
}
this->m_pArgs.clear();
if( this->m_pTmpArgs )
{
delete [] this->m_pTmpArgs;
}
}
bool CMonoArguments::Push( MonoString* pString )
{
this->m_pArgs.push_back( make_pair( pString, false ) );
return true;
}
bool CMonoArguments::Push( MonoObject* pObject )
{
this->m_pArgs.push_back( make_pair( pObject, false ) );
return true;
}
PVOID* CMonoArguments::GetArgs( void )
{
if( this->m_pTmpArgs == nullptr )
{
this->m_pTmpArgs = new PVOID[ this->Length() ];
uint i = 0;
for( const auto& iter : this->m_pArgs )
{
this->m_pTmpArgs[ i++ ] = iter.first;
}
}
return this->m_pTmpArgs;
}
const size_t CMonoArguments::Length( void ) const
{
return this->m_pArgs.size();
}
PVOID CMonoArguments::operator[]( int index )
{
ASSERT( index < this->Length() );
return this->GetArgs()[ index ];
}
PVOID* CMonoArguments::operator*( void )
{
return this->GetArgs();
}

View File

@ -0,0 +1,50 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
class CMonoArguments;
#ifndef __CMONOARGUMENTS_H
#define __CMONOARGUMENTS_H
class CMonoArguments
{
private:
PVOID* m_pTmpArgs;
vector< pair< PVOID, bool > > m_pArgs;
public:
CMonoArguments ( void );
~CMonoArguments ( void );
template< typename Type >
bool Push ( Type Value )
{
Type* pValue = new Type;
*pValue = Value;
this->m_pArgs.push_back( make_pair( pValue, true ) );
return true;
}
bool Push ( MonoString* pString );
bool Push ( MonoObject* pObject );
PVOID* GetArgs ( void );
const size_t Length ( void ) const;
PVOID operator[] ( int index );
PVOID* operator* ( void );
};
#endif