本文整理汇总了C++中RefCountPtr类的典型用法代码示例。如果您正苦于以下问题:C++ RefCountPtr类的具体用法?C++ RefCountPtr怎么用?C++ RefCountPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RefCountPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: THROW_EXCEPTION
METHOD_RETURN_TYPE PDFDictionaryDriver::QueryObject(const ARGS_TYPE& args)
{
CREATE_ISOLATE_CONTEXT;
CREATE_ESCAPABLE_SCOPE;
if(args.Length() != 1 || !args[0]->IsString())
{
THROW_EXCEPTION("wrong arguments, pass 1 argument which is a string key");
SET_FUNCTION_RETURN_VALUE(UNDEFINED);
}
std::string key = *String::Utf8Value(args[0]->ToString());
PDFDictionaryDriver* driver = ObjectWrap::Unwrap<PDFDictionaryDriver>(args.This());
if(!driver->TheObject->Exists(key))
{
THROW_EXCEPTION("key not found");
SET_FUNCTION_RETURN_VALUE(UNDEFINED);
}
RefCountPtr<PDFObject> anObject = driver->TheObject->QueryDirectObject(key);
Handle<Value> result = PDFObjectDriver::CreateDriver(anObject.GetPtr());
SET_FUNCTION_RETURN_VALUE(result);
}
示例2: PDFDictionary
PDFObject* PDFObjectParser::ParseDictionary(IPDFParserExtender* inParserExtender)
{
PDFDictionary* aDictionary = new PDFDictionary();
bool dictionaryEndEncountered = false;
std::string token;
EStatusCode status = PDFHummus::eSuccess;
while(GetNextToken(token) && PDFHummus::eSuccess == status)
{
dictionaryEndEncountered = (scDoubleRightAngle == token);
if(dictionaryEndEncountered)
break;
ReturnTokenToBuffer(token);
// Parse Key
PDFObjectCastPtr<PDFName> aKey(ParseNewObject(inParserExtender));
if(!aKey)
{
status = PDFHummus::eFailure;
TRACE_LOG1("PDFObjectParser::ParseDictionary, failure to parse key for a dictionary. token = %s",token.c_str());
break;
}
// i'll consider duplicate keys as failure
if(aDictionary->Exists(aKey->GetValue()))
{
status = PDFHummus::eFailure;
TRACE_LOG1("PDFObjectParser::ParseDictionary, failure to parse key for a dictionary, key already exists. key = %s",aKey->GetValue().c_str());
break;
}
// Parse Value
RefCountPtr<PDFObject> aValue = ParseNewObject(inParserExtender);
if(!aValue)
{
status = PDFHummus::eFailure;
TRACE_LOG1("PDFObjectParser::ParseDictionary, failure to parse value for a dictionary. token = %s",token.c_str());
break;
}
// all well, add the two items to the dictionary
aDictionary->Insert(aKey.GetPtr(),aValue.GetPtr());
}
if(dictionaryEndEncountered && PDFHummus::eSuccess == status)
{
return aDictionary;
}
else
{
delete aDictionary;
TRACE_LOG1("PDFObjectParser::ParseDictionary, failure to parse dictionary, didn't find end of array or failure to parse dictionary member object. token = %s",token.c_str());
return NULL;
}
}
示例3: PDFDictionary
PDFObject* PDFObjectParser::ParseDictionary()
{
PDFDictionary* aDictionary = new PDFDictionary();
bool dictionaryEndEncountered = false;
std::string token;
EStatusCode status = PDFHummus::eSuccess;
while(GetNextToken(token) && PDFHummus::eSuccess == status)
{
dictionaryEndEncountered = (scDoubleRightAngle == token);
if(dictionaryEndEncountered)
break;
ReturnTokenToBuffer(token);
// Parse Key
PDFObjectCastPtr<PDFName> aKey(ParseNewObject());
if(!aKey)
{
status = PDFHummus::eFailure;
TRACE_LOG1("PDFObjectParser::ParseDictionary, failure to parse key for a dictionary. token = %s",token.substr(0, MAX_TRACE_SIZE - 200).c_str());
break;
}
// Parse Value
RefCountPtr<PDFObject> aValue = ParseNewObject();
if(!aValue)
{
status = PDFHummus::eFailure;
TRACE_LOG1("PDFObjectParser::ParseDictionary, failure to parse value for a dictionary. token = %s",token.substr(0, MAX_TRACE_SIZE - 200).c_str());
break;
}
// all good. i'm gonna be forgiving here and allow skipping duplicate keys. cause it happens
if(!aDictionary->Exists(aKey->GetValue()))
aDictionary->Insert(aKey.GetPtr(),aValue.GetPtr());
}
if(dictionaryEndEncountered && PDFHummus::eSuccess == status)
{
return aDictionary;
}
else
{
delete aDictionary;
TRACE_LOG1("PDFObjectParser::ParseDictionary, failure to parse dictionary, didn't find end of array or failure to parse dictionary member object. token = %s",token.substr(0, MAX_TRACE_SIZE - 200).c_str());
return NULL;
}
}
示例4: matrixFreeEpetraOperator
//-----------------------------------------------------------------------------
// Function : matrixFreeEpetraOperator
// Purpose : non-member constructor
// Special Notes :
// Scope : public
// Creator : Todd Coffey, 1414
// Creation Date : 9/4/08
//-----------------------------------------------------------------------------
RefCountPtr<MatrixFreeEpetraOperator> matrixFreeEpetraOperator(
RefCountPtr<NonLinearSolver> nonlinearSolver,
RefCountPtr<N_LAS_Vector> solVector,
RefCountPtr<N_LAS_Vector> rhsVector,
RefCountPtr<const Epetra_Map> solutionMap
)
{
RefCountPtr<MatrixFreeEpetraOperator> epetraOperator =
rcp(new MatrixFreeEpetraOperator);
epetraOperator->initialize(nonlinearSolver,
solVector,
rhsVector,
solutionMap
);
return epetraOperator;
}
示例5: StaticGetCertCallback
void AuthContext::StaticGetCertCallback(AsyncOpPtr theOp, RefCountPtr theParam)
{
GetCertOp *anOp = (GetCertOp*)theOp.get();
AuthContext *aContext = (AuthContext*)theParam.get();
aContext->GetCertCallback(anOp);
}
示例6: StaticConnectCallback
void ServerConnection::StaticConnectCallback(AsyncOpPtr theOp, RefCountPtr theParam)
{
PeerAuthOp *anOp = (PeerAuthOp*)theOp.get();
ServerConnection *thisConnection = (ServerConnection*)theParam.get();
thisConnection->ConnectCallback(anOp);
}
示例7: StaticMsgCallback
void ServerConnection::StaticMsgCallback(AsyncOpPtr theOp, RefCountPtr theParam)
{
RecvMsgOp *anOp = (RecvMsgOp*)theOp.get();
ServerConnection *thisConnection = (ServerConnection*)theParam.get();
if(anOp->GetStatus()==WS_Success)
thisConnection->MsgCallback(anOp->GetMsg());
}
示例8: showXObjectsPerPageInfo
void showXObjectsPerPageInfo(PDFParser& parser,PDFObjectCastPtr<PDFDictionary> xobjects)
{
RefCountPtr<PDFName> key;
PDFObjectCastPtr<PDFIndirectObjectReference> value;
MapIterator<PDFNameToPDFObjectMap> it = xobjects->GetIterator();
while(it.MoveNext())
{
key = it.GetKey();
value = it.GetValue();
cout << "XObject named " << key->GetValue().c_str() << " is object " << value->mObjectID << " of type ";
PDFObjectCastPtr<PDFStreamInput> xobject(parser.ParseNewObject(value->mObjectID));
PDFObjectCastPtr<PDFDictionary> xobjectDictionary(xobject->QueryStreamDictionary());
PDFObjectCastPtr<PDFName> typeOfXObject = xobjectDictionary->QueryDirectObject("Subtype");
cout << typeOfXObject->GetValue().c_str() << "\n";
}
}
示例9: createSymbTable
SymbolTablePtr createSymbTable(size_t size, SymbolTablePtr parentTable) {
RefCountPtr<SymbolTable> result;
switch (size) {
case 0:
return parentTable;
case 1:
result.reset(new SmallTable<1>(parentTable));
break;
case 2:
result.reset(new SmallTable<2>(parentTable));
break;
case 3:
result.reset(new SmallTable<3>(parentTable));
break;
default:
result.reset(new HashTable(parentTable));
}
return result;
}
示例10: showPageContent
void showPageContent(PDFParser& parser, RefCountPtr<PDFObject> contents, InputFile& pdfFile)
{
if(contents->GetType() == ePDFObjectArray)
{
PDFObjectCastPtr<PDFIndirectObjectReference> streamReferences;
SingleValueContainerIterator<PDFObjectVector> itContents = ((PDFArray*)contents.GetPtr())->GetIterator();
// array of streams
while(itContents.MoveNext())
{
streamReferences = itContents.GetItem();
PDFObjectCastPtr<PDFStreamInput> stream = parser.ParseNewObject(streamReferences->mObjectID);
showContentStream(stream.GetPtr(),pdfFile.GetInputStream(),parser);
}
}
else
{
// stream
showContentStream((PDFStreamInput*)contents.GetPtr(),pdfFile.GetInputStream(),parser);
}
}
示例11: PumpTimerCompletion
void GameSpySupport::PumpTimerCompletion(AsyncOpPtr theOp, RefCountPtr theParam)
{
if (theOp.get() == NULL)
return;
if (theOp->Killed())
return;
GameSpySupport *pThat = (GameSpySupport*)theParam.get();
pThat->Pump();
}
示例12: ctor
/*----------------------------------------------------------------------*
| ctor (public) m.gee 3/06|
*----------------------------------------------------------------------*/
NLNML::NLNML_ConstrainedMultiLevelOperator::NLNML_ConstrainedMultiLevelOperator(
RefCountPtr<ML_Epetra::MultiLevelOperator> ml_operator,
RefCountPtr<NLNML::NLNML_CoarseLevelNoxInterface> coarseinterface,
bool applyconstraints) :
comm_(ml_operator->Comm()),
coarseinterface_(coarseinterface),
ml_operator_(ml_operator),
applyconstraints_(applyconstraints)
{
label_ = "NLNML_ConstrainedMultiLevelOperator";
return;
}
示例13: EmbedProfile
void JPEGSaver::EmbedProfile(RefCountPtr<CMSProfile> profile)
{
if(!profile)
return;
if(!cinfo)
throw "JPEGSaver: cinfo already freed!";
BinaryBlob *blob=profile->GetBlob();
size_t EmbedLen=blob->GetSize();
JOCTET *EmbedBuffer=(JOCTET *)blob->GetPointer();
write_icc_profile(cinfo,EmbedBuffer,EmbedLen);
delete blob;
}
示例14: ThrowException
Handle<Value> PDFArrayDriver::QueryObject(const Arguments& args)
{
HandleScope scope;
if(args.Length() != 1 || !args[0]->IsNumber())
{
ThrowException(Exception::TypeError(String::New("wrong arguments, pass 1 argument which is an index in the array")));
return scope.Close(Undefined());
}
PDFArrayDriver* arrayDriver = ObjectWrap::Unwrap<PDFArrayDriver>(args.This());
if(args[0]->ToNumber()->Uint32Value() >= arrayDriver->TheObject->GetLength())
{
ThrowException(Exception::Error(String::New("wrong arguments, pass 1 argument which is a valid index in the array")));
return scope.Close(Undefined());
}
RefCountPtr<PDFObject> anObject = arrayDriver->TheObject->QueryObject(args[0]->ToNumber()->Uint32Value());
Handle<Value> result = PDFObjectDriver::CreateDriver(anObject.GetPtr());
return scope.Close(result);
}
示例15: THROW_EXCEPTION
METHOD_RETURN_TYPE PDFArrayDriver::QueryObject(const ARGS_TYPE& args)
{
CREATE_ISOLATE_CONTEXT;
CREATE_ESCAPABLE_SCOPE;
if(args.Length() != 1 || !args[0]->IsNumber())
{
THROW_EXCEPTION("wrong arguments, pass 1 argument which is an index in the array");
SET_FUNCTION_RETURN_VALUE(UNDEFINED);
}
PDFArrayDriver* arrayDriver = ObjectWrap::Unwrap<PDFArrayDriver>(args.This());
if(args[0]->ToNumber()->Uint32Value() >= arrayDriver->TheObject->GetLength())
{
THROW_EXCEPTION("wrong arguments, pass 1 argument which is a valid index in the array");
SET_FUNCTION_RETURN_VALUE(UNDEFINED);
}
RefCountPtr<PDFObject> anObject = arrayDriver->TheObject->QueryObject(args[0]->ToNumber()->Uint32Value());
Handle<Value> result = PDFObjectDriver::CreateDriver(anObject.GetPtr());
SET_FUNCTION_RETURN_VALUE(result);
}