本文整理汇总了C++中GetIdent函数的典型用法代码示例。如果您正苦于以下问题:C++ GetIdent函数的具体用法?C++ GetIdent怎么用?C++ GetIdent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetIdent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _TRACE
void CStatement::Action(const CDbapiEvent& e)
{
_TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName()
<< "' received from " << e.GetSource()->GetIdent());
CResultSet *rs;
if (dynamic_cast<const CDbapiFetchCompletedEvent*>(&e) != 0 ) {
if( m_irs != 0 && (rs = dynamic_cast<CResultSet*>(e.GetSource())) != 0 ) {
if( rs == m_irs ) {
m_rowCount = rs->GetTotalRows();
_TRACE("Rowcount from the last resultset: " << m_rowCount);
}
}
}
if (dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
RemoveListener(e.GetSource());
if(dynamic_cast<CConnection*>(e.GetSource()) != 0 ) {
_TRACE("Deleting " << GetIdent() << " " << (void*)this);
delete this;
}
else if( m_irs != 0 && (rs = dynamic_cast<CResultSet*>(e.GetSource())) != 0 ) {
if( rs == m_irs ) {
_TRACE("Clearing cached CResultSet " << (void*)m_irs);
m_irs = 0;
}
}
}
}
示例2: assert
//-----------------------------------------------------------------------------------------------
void OprtSubCmplx::Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int num)
{
assert(num==2);
const IValue *arg1 = a_pArg[0].Get();
const IValue *arg2 = a_pArg[1].Get();
if ( a_pArg[0]->IsNonComplexScalar() && a_pArg[1]->IsNonComplexScalar())
{
*ret = arg1->GetFloat() - arg2->GetFloat();
}
else if (a_pArg[0]->GetType()=='m' && a_pArg[1]->GetType()=='m')
{
// Matrix + Matrix
*ret = arg1->GetArray() - arg2->GetArray();
}
else
{
if (!a_pArg[0]->IsScalar())
throw ParserError( ErrorContext(ecTYPE_CONFLICT_FUN, GetExprPos(), GetIdent(), a_pArg[0]->GetType(), 'c', 1));
if (!a_pArg[1]->IsScalar())
throw ParserError( ErrorContext(ecTYPE_CONFLICT_FUN, GetExprPos(), GetIdent(), a_pArg[1]->GetType(), 'c', 2));
*ret = cmplx_type(a_pArg[0]->GetFloat() - a_pArg[1]->GetFloat(),
a_pArg[0]->GetImag() - a_pArg[1]->GetImag());
}
}
示例3: _TRACE
void CResultSet::Action(const CDbapiEvent& e)
{
_TRACE(GetIdent() << " " << (void*)this
<< ": '" << e.GetName()
<< "' received from " << e.GetSource()->GetIdent());
if(dynamic_cast<const CDbapiClosedEvent*>(&e) != 0 ) {
if( dynamic_cast<CStatement*>(e.GetSource()) != 0
|| dynamic_cast<CCallableStatement*>(e.GetSource()) != 0 ) {
if( m_rs != 0 ) {
_TRACE("Discarding old CDB_Result " << (void*)m_rs);
Invalidate();
}
}
}
else if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
RemoveListener(e.GetSource());
if(dynamic_cast<CStatement*>(e.GetSource()) != 0
|| dynamic_cast<CCursor*>(e.GetSource()) != 0
|| dynamic_cast<CCallableStatement*>(e.GetSource()) != 0 ) {
_TRACE("Deleting " << GetIdent() << " " << (void*)this);
delete this;
}
}
}
示例4: GetIdent
/** \brief Return the value as an integer.
This function should only be called if you really need an integer value and
want to make sure your either get one or throw an exception if the value
can not be implicitely converted into an integer.
*/
int_type Value::GetInteger() const
{
float_type v = m_val.real();
if (m_cType!='i') //!IsScalar() || (int_type)v-v!=0)
{
ErrorContext err;
err.Errc = ecTYPE_CONFLICT;
err.Type1 = m_cType;
err.Type2 = 'i';
if (GetIdent().length())
{
err.Ident = GetIdent();
}
else
{
stringstream_type ss;
ss << *this;
err.Ident = ss.str();
}
throw ParserError(err);
}
return (int_type)v;
}
示例5: indices
/** \brief Index operator implementation
\param ret A reference to the return value
\param a_pArg Pointer to an array with the indices as ptr_val_type
\param a_iArgc Number of indices (=dimension) actully used in the expression found. This must
be 1 or 2 since three dimensional data structures are not supported by muParserX.
*/
void OprtIndex::At(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc)
{
try
{
// The index is -1, thats the actual variable reference
if (a_iArgc!=a_pArg[-1]->GetDim())
{
throw ParserError(ErrorContext(ecINDEX_DIMENSION, -1, GetIdent()));
}
switch(a_iArgc)
{
case 1:
ret.Reset(new Variable( &(ret->At(*a_pArg[0], Value(0))) ) );
break;
case 2:
ret.Reset(new Variable( &(ret->At(*a_pArg[0], *a_pArg[1])) ) );
break;
default:
throw ParserError(ErrorContext(ecINDEX_DIMENSION, -1, GetIdent()));
}
}
catch(ParserError &exc)
{
exc.GetContext().Pos = GetExprPos();
throw exc;
}
}
示例6: LookupIdent
static SymPtr LookupIdent(char **name)
{
SymPtr sym=NULL,parent;
/* check this class only */
if( in_class && Token==tSELF )
{
SkipToken(tSELF);
SkipToken(tPERIOD);
*name = GetIdent();
sym = SymFindLevel(*name,(SymGetScope()-1));
}
/* check super class only */
else if( in_class && Token==tSUPER && base_class->super!=NULL )
{
SkipToken(tSUPER);
SkipToken(tPERIOD);
*name = GetIdent();
sym = SymFindLocal(*name,base_class->super);
if( sym!=NULL && sym->flags&SYM_PRIVATE )
{
compileError("attempt to access private field '%s'",*name);
NextToken();
return COMPILE_ERROR;
}
}
/* check all super classes */
else if( in_class )
{
*name = GetIdent();
parent=base_class->super;
while(parent!=NULL)
{
sym = SymFindLocal(*name,parent);
if(sym!=NULL) break;
parent=parent->super;
}
if( sym!=NULL && sym->flags&SYM_PRIVATE )
{
compileError("attempt to access private field '%s'",*name);
NextToken();
return COMPILE_ERROR;
}
}
/* check globals */
if( sym==NULL )
{
*name = GetIdent();
sym = SymFind(*name);
}
return sym;
}
示例7: assert
/** \brief Implements the Division operator.
\throw ParserError in case one of the arguments if
nonnumeric or an array.
*/
void OprtDiv::Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int num)
{
assert(num==2);
if (!a_pArg[0]->IsNonComplexScalar())
throw ParserError( ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), a_pArg[0]->GetType(), 'f', 1));
if (!a_pArg[1]->IsNonComplexScalar())
throw ParserError( ErrorContext(ecTYPE_CONFLICT_FUN, -1, GetIdent(), a_pArg[1]->GetType(), 'f', 2));
*ret = a_pArg[0]->GetFloat() / a_pArg[1]->GetFloat();
}
示例8: _TRACE
void CDBAPIBulkInsert::Action(const CDbapiEvent& e)
{
_TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName()
<< "' from " << e.GetSource()->GetIdent());
if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
RemoveListener(e.GetSource());
if(dynamic_cast<CConnection*>(e.GetSource()) != 0 ) {
_TRACE("Deleting " << GetIdent() << " " << (void*)this);
delete this;
}
}
}
示例9: ParserError
//------------------------------------------------------------------------------
void FunMax::Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc)
{
if (a_iArgc < 1)
throw ParserError(ErrorContext(ecTOO_FEW_PARAMS, GetExprPos(), GetIdent()));
float_type smax(-1e30), sval(0);
for (int i=0; i<a_iArgc; ++i)
{
switch(a_pArg[i]->GetType())
{
case 'f': sval = a_pArg[i]->GetFloat(); break;
case 'i': sval = a_pArg[i]->GetFloat(); break;
case 'n': break; // ignore not in list entries (missing parameter)
case 'c':
default:
{
ErrorContext err;
err.Errc = ecTYPE_CONFLICT_FUN;
err.Arg = i+1;
err.Type1 = a_pArg[i]->GetType();
err.Type2 = 'f';
throw ParserError(err);
}
}
smax = max(smax, sval);
}
*ret = smax;
}
示例10: time
CString& CUser::ExpandString(const CString& sStr, CString& sRet) const {
// offset is in hours, so * 60 * 60 gets us seconds
time_t iUserTime = time(NULL) + (time_t)(m_fTimezoneOffset * 60 * 60);
char *szTime = ctime(&iUserTime);
CString sTime;
if (szTime) {
sTime = szTime;
// ctime() adds a trailing newline
sTime.Trim();
}
sRet = sStr;
sRet.Replace("%user%", GetUserName());
sRet.Replace("%defnick%", GetNick());
sRet.Replace("%nick%", GetNick());
sRet.Replace("%altnick%", GetAltNick());
sRet.Replace("%ident%", GetIdent());
sRet.Replace("%realname%", GetRealName());
sRet.Replace("%vhost%", GetBindHost());
sRet.Replace("%bindhost%", GetBindHost());
sRet.Replace("%version%", CZNC::GetVersion());
sRet.Replace("%time%", sTime);
sRet.Replace("%uptime%", CZNC::Get().GetUptime());
// The following lines do not exist. You must be on DrUgS!
sRet.Replace("%znc%", "All your IRC are belong to ZNC");
// Chosen by fair zocchihedron dice roll by SilverLeo
sRet.Replace("%rand%", "42");
return sRet;
}
示例11: GetCode
//-----------------------------------------------------------------------------------------------
string_type Variable::AsciiDump() const
{
stringstream_type ss;
ss << g_sCmdCode[ GetCode() ];
ss << _T(" [addr=0x") << std::hex << this << std::dec;
ss << _T("; id=\"") << GetIdent() << _T("\"");
ss << _T("; type=\"") << GetType() << _T("\"");
ss << _T("; val=");
switch(GetType())
{
case 'i':
ss << (int_type)GetFloat();
break;
case 'f':
ss << GetFloat();
break;
case 'm':
ss << _T("(array)");
break;
case 's':
ss << _T("\"") << GetString() << _T("\"");
break;
}
ss << ((IsFlagSet(IToken::flVOLATILE)) ? _T("; ") : _T("; not ")) << _T("volatile");
ss << _T("]");
return ss.str();
}
示例12: ParserError
/** \brief Verify the operator prototype.
Binary operators have the additional constraint that return type and the types
of both arguments must be the same. So adding to floats can not produce a string
and adding a number to a string is impossible.
*/
void IOprtBin::CheckPrototype(const string_type &a_sProt)
{
if (a_sProt.length()!=4)
throw ParserError( ErrorContext(ecAPI_INVALID_PROTOTYPE, -1, GetIdent() ) );
//if (a_sProt[0]!=a_sProt[2] || a_sProt[0]!=a_sProt[3])
// throw ParserError( ErrorContext(ecAPI_INVALID_PROTOTYPE, -1, GetIdent() ) );
}
示例13: _TRACE
void CConnection::Action(const CDbapiEvent& e)
{
_TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName()
<< "' received from " << e.GetSource()->GetIdent() << " " << (void*)e.GetSource());
if(dynamic_cast<const CDbapiClosedEvent*>(&e) != 0 ) {
/*
CStatement *stmt;
CCallableStatement *cstmt;
CCursor *cursor;
CDBAPIBulkInsert *bulkInsert;
if( (cstmt = dynamic_cast<CCallableStatement*>(e.GetSource())) != 0 ) {
if( cstmt == m_cstmt ) {
_TRACE("CConnection: Clearing cached callable statement " << (void*)m_cstmt);
m_cstmt = 0;
}
}
else if( (stmt = dynamic_cast<CStatement*>(e.GetSource())) != 0 ) {
if( stmt == m_stmt ) {
_TRACE("CConnection: Clearing cached statement " << (void*)m_stmt);
m_stmt = 0;
}
}
else if( (cursor = dynamic_cast<CCursor*>(e.GetSource())) != 0 ) {
if( cursor == m_cursor ) {
_TRACE("CConnection: Clearing cached cursor " << (void*)m_cursor);
m_cursor = 0;
}
}
else if( (bulkInsert = dynamic_cast<CDBAPIBulkInsert*>(e.GetSource())) != 0 ) {
if( bulkInsert == m_bulkInsert ) {
_TRACE("CConnection: Clearing cached bulkinsert " << (void*)m_bulkInsert);
m_bulkInsert = 0;
}
}
*/
if( m_connCounter == 1 )
m_connUsed = false;
}
else if(dynamic_cast<const CDbapiAuxDeletedEvent*>(&e) != 0 ) {
if( m_connCounter > 1 ) {
--m_connCounter;
_TRACE("Server: " << GetCDB_Connection()->ServerName()
<<", connections left: " << m_connCounter);
}
else
m_connUsed = false;
}
else if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
RemoveListener(e.GetSource());
if(dynamic_cast<CDataSource*>(e.GetSource()) != 0 ) {
if( m_ownership == eNoOwnership ) {
delete this;
}
}
}
}
示例14: SkipWhiteSpace
Token* Tokenizer::GetNext() {
Token* T = NULL;
// First check to see if there is an UnGetToken. If there is, use it.
if (UnGetToken != NULL) {
T = UnGetToken;
UnGetToken = NULL;
return T;
}
// Otherwise, crank up the scanner and get a new token.
// Get rid of any whitespace
SkipWhiteSpace();
// test for end of file
if (buffer.isEOF()) {
T = new Token(EOFSYM);
} else {
// Save the starting position of the symbol in a variable,
// so that nicer error messages can be produced.
TokenColumn = buffer.CurColumn();
// Check kind of current character
// Note that _'s are now allowed in identifiers.
if (isalpha(CurrentCh) || '_' == CurrentCh) {
// grab identifier or reserved word
T = GetIdent();
} else if ( '"' == CurrentCh) {
T = GetQuotedIdent();
} else if (isdigit(CurrentCh) || '-' == CurrentCh || '.' == CurrentCh) {
T = GetScalar();
} else {
//
// Check for other tokens
//
T = GetPunct();
}
}
if (T == NULL) {
throw ParserFatalException("didn't get a token");
}
if (_printTokens) {
std::cout << "Token read: ";
T->Print();
std::cout << std::endl;
}
return T;
}
示例15: Notify
CResultSet::~CResultSet()
{
try {
Notify(CDbapiClosedEvent(this));
FreeResources();
Notify(CDbapiDeletedEvent(this));
_TRACE(GetIdent() << " " << (void*)this << " deleted.");
}
NCBI_CATCH_ALL_X( 6, kEmptyStr )
}