本文整理汇总了C++中IsEmpty函数的典型用法代码示例。如果您正苦于以下问题:C++ IsEmpty函数的具体用法?C++ IsEmpty怎么用?C++ IsEmpty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsEmpty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNumGeometries
OGRErr OGRMultiPoint::exportToWkt( char ** ppszDstText,
OGRwkbVariant eWkbVariant ) const
{
int nMaxString = getNumGeometries() * 22 + 128;
int nRetLen = 0;
/* -------------------------------------------------------------------- */
/* Return MULTIPOINT EMPTY if we get no valid points. */
/* -------------------------------------------------------------------- */
if( IsEmpty() )
{
if( getCoordinateDimension() == 3 && eWkbVariant == wkbVariantIso )
*ppszDstText = CPLStrdup("MULTIPOINT Z EMPTY");
else
*ppszDstText = CPLStrdup("MULTIPOINT EMPTY");
return OGRERR_NONE;
}
*ppszDstText = (char *) VSIMalloc( nMaxString );
if( *ppszDstText == NULL )
return OGRERR_NOT_ENOUGH_MEMORY;
if( getCoordinateDimension() == 3 && eWkbVariant == wkbVariantIso )
sprintf( *ppszDstText, "%s Z (", getGeometryName() );
else
sprintf( *ppszDstText, "%s (", getGeometryName() );
int bMustWriteComma = FALSE;
for( int i = 0; i < getNumGeometries(); i++ )
{
OGRPoint *poPoint = (OGRPoint *) getGeometryRef( i );
if (poPoint->IsEmpty())
{
CPLDebug( "OGR", "OGRMultiPoint::exportToWkt() - skipping POINT EMPTY.");
continue;
}
if( bMustWriteComma )
strcat( *ppszDstText + nRetLen, "," );
bMustWriteComma = TRUE;
nRetLen += strlen(*ppszDstText + nRetLen);
if( nMaxString < nRetLen + 100 )
{
nMaxString = nMaxString * 2;
*ppszDstText = (char *) CPLRealloc(*ppszDstText,nMaxString);
}
if( eWkbVariant == wkbVariantIso )
{
strcat( *ppszDstText + nRetLen, "(" );
nRetLen ++;
}
OGRMakeWktCoordinate( *ppszDstText + nRetLen,
poPoint->getX(),
poPoint->getY(),
poPoint->getZ(),
poPoint->getCoordinateDimension() );
if( eWkbVariant == wkbVariantIso )
{
strcat( *ppszDstText + nRetLen, ")" );
nRetLen ++;
}
}
strcat( *ppszDstText+nRetLen, ")" );
return OGRERR_NONE;
}
示例2: ConvertRect
bool
TopographyFile::Update(const WindowProjection &map_projection)
{
if (IsEmpty())
return false;
if (map_projection.GetMapScale() > scale_threshold)
/* not visible, don't update cache now */
return false;
const GeoBounds screenRect =
map_projection.GetScreenBounds();
if (cache_bounds.inside(screenRect))
/* the cache is still fresh */
return false;
cache_bounds = map_projection.GetScreenBounds().scale(fixed_two);
rectObj deg_bounds = ConvertRect(cache_bounds);
// Test which shapes are inside the given bounds and save the
// status to file.status
msShapefileWhichShapes(&file, dir, deg_bounds, 0);
// If not a single shape is inside the bounds
if (!file.status) {
// ... clear the whole buffer
ClearCache();
return false;
}
// Iterate through the shapefile entries
for (int i = 0; i < file.numshapes; i++) {
if (!msGetBit(file.status, i)) {
// If the shape is outside the bounds
// delete the shape from the cache
delete shapes[i].shape;
shapes[i].shape = NULL;
} else if (shapes[i].shape == NULL) {
// If the shape is inside the bounds and if the
// shape isn't cached yet -> cache the shape
shapes[i].shape = new XShape(&file, i, label_field);
}
}
ShapeList::NotNull not_null;
XShapePointerArray::iterator end = shapes.end(), it = shapes.begin();
it = std::find_if(it, end, not_null);
if (it != shapes.end()) {
ShapeList *current = &*it;
first = current;
while (true) {
++it;
it = std::find_if(it, end, not_null);
if (it == end) {
current->next = NULL;
break;
}
ShapeList *next = &*it;
current->next = next;
current = next;
}
} else
first = NULL;
return true;
}
示例3: IsEmpty
bool MyProduceConsume::ConsumeComplete() {
return IsEmpty() && ProduceComplete();
}
示例4: storage
BOOLEAN
FxEventQueue::QueueToThreadWorker(
VOID
)
/*++
Routine Description:
Generic worker function which encapsulates the logic of whether to enqueue
onto a different thread if the thread has not already been queued to.
NOTE: this function could have been virtual, or call a virtual worker function
once we have determined that we need to queue to a thread. But to save
space on vtable storage (why have one unless you really need one?),
we rearrange the code so that the derived class calls the worker function
and this function indicates in its return value what the caller should
do
Arguments:
None
Return Value:
TRUE if the caller should queue to a thread to do the work
FALSE if the caller shoudl not queue to a thread b/c it has already been
queued
--*/
{
KIRQL irql;
BOOLEAN result;
Lock(&irql);
//
// For one reason or another, we couldn't run the state machine on this
// thread. So queue a work item to do it.
//
if (IsEmpty()) {
//
// There is no work to do. This means that the caller inserted the
// event into the queue, dropped the lock, and then another thread came
// in and processed the event.
//
// This check also helps in the rundown case when the queue is closing
// and the following happens between 2 thread:
// #1 #2
// insert event
// drop lock
// process event queue
// queue goes to empty, so event is set
// try to queue work item
//
result = FALSE;
DoTraceLevelMessage(
m_PkgPnp->GetDriverGlobals(), TRACE_LEVEL_INFORMATION, TRACINGPNP,
"WDFDEVICE 0x%p !devobj 0x%p not queueing work item to process "
"event queue", m_PkgPnp->GetDevice()->GetHandle(),
m_PkgPnp->GetDevice()->GetDeviceObject());
}
else if ((m_QueueFlags & FxEventQueueFlagWorkItemQueued) == 0x00) {
m_QueueFlags |= FxEventQueueFlagWorkItemQueued;
result = TRUE;
}
else {
//
// Somebody is already in the process of enqueuing the work item.
//
result = FALSE;
}
Unlock(irql);
return result;
}
示例5: SeqWrap
Prefix::Prefix( const struct PROJ_DB * pDB ) : SeqWrap()
{
//#define GetDBPrefix_PRINT_DEBUG_INFO
int i = 0;
int j = 0;
int JMax = 1;
bool Inter;
SeqWrap * aSeqWrap = NULL;
bool PrefixIsEmpty = true;
#ifdef GetDBPrefix_PRINT_DEBUG_INFO
Sequence * aSeq = NULL;
Sequence * tmpSeq = NULL;
static int Cnt = 0;
tmpSeq = new Sequence( pDB );
printf( " Original Prefix %dth Record ===> ", Cnt++ );
(*tmpSeq).Print();
delete tmpSeq;
#endif
End = NULL;
NumOfItemSets = 0;
//Sup = 1;
Sup = 0;
if( (*pDB).m_nSup > 0 )
{
// Find first none empty sequence.
for( i=0; i<(*pDB).m_nSup; i++ )
{
for( j=0; j < (*pDB).m_pProjSeq[i].m_nProjCount; j++ )
{
aSeqWrap = new SeqWrap( GetStartPtr( pDB, i, j ) );
if( !(*aSeqWrap).IsEmpty() )
{
Start = (*aSeqWrap).GetFirst();
End = GetEndPtr( Start ) - 1;
//TrimPrefix( Start ); //Trim it with itself.
PrefixIsEmpty = false;
#ifdef GetDBPrefix_PRINT_DEBUG_INFO
aSeq = new Sequence( Start, End-Start, 0, true );
printf( " First Prefix %dth Record ===> ", i+1 );
if( aSeq ) (*aSeq).Print();
printf( " Real First Start=%d End=%d Size=%d ===> ", Start, End, End-Start );
Print();
#endif
delete aSeqWrap;
break;
}
delete aSeqWrap;
}
if( Start != End )
break;
}
}
if( Start != End )
{
JMax = 1;
if( *(Start) == -1 )
Inter = true;
else
Inter = false;
//for( i++; i<(*pDB).m_nSup; i++ ) // For every seq in DB
for( i; i<(*pDB).m_nSup; i++ ) // For every seq in DB
{
if( !Inter )
JMax = (*pDB).m_pProjSeq[i].m_nProjCount;
//JMax = 1;
for( j=0; j < JMax; j++ )
{
aSeqWrap = new SeqWrap( GetStartPtr( pDB, i, j ) );
#ifdef GetDBPrefix_PRINT_DEBUG_INFO
tmpSeq = new Sequence( (*aSeqWrap).GetFirst(), true );
printf( " %dth Record ===> ", i+1 );
(*tmpSeq).Print();
delete tmpSeq;
#endif
if( !(*aSeqWrap).IsEmpty() )
{
TrimPrefix( (*aSeqWrap).GetFirst() );
Sup++;
#ifdef GetDBPrefix_PRINT_DEBUG_INFO
if( Start != End )
{
aSeq = new Sequence( Start, End-Start, 0, true );
printf( " ++++++++++++++++ Remaining prefix is " );
(*aSeq).Print();
printf( " +++++Real Start=%d End=%d Size=%d prefix is ", Start, End, End-Start );
Print();
}
//.........这里部分代码省略.........
示例6: On_edtValue_Change
void CVkWallPostForm::On_edtValue_Change(CCtrlEdit*)
{
m_btnShare.Enable(!IsEmpty(ptrT(m_edtMsg.GetText())) || !IsEmpty(ptrT(m_edtUrl.GetText())));
}
示例7: PrintResult
void PrintResult( LineData * dest_lines, int comm_size, size_t linesize )
{
LineData * pline;
char nodelist[MAXNODELIST];
char * pnext;
char * ptoken;
int numc;
int i;
/* Look for lines that survived the merge and print them*/
for( pline = dest_lines, i = 0; i < comm_size;
pline += linesize, i++ ) {
if( !IsEmpty( pline+SET ) ) {
/* Create a compact list of nodes for this string */
int j, start = INVALID, end, firsttime = 1;
int hasnodepattern = 0;
pnext = nodelist;
for( j = 0; j < comm_size; j++ ) {
if( CheckSet( pline+SET, j ) ) {
STARTRANGE(start,end,j);
} else if ( start != INVALID ) {
ENDRANGE(start,end,firsttime);
}
}
if( start != INVALID ) {
ENDRANGE(start,end,firsttime);
}
/* Reconvert the node list substitution and the
* literal percent patterns.
*/
for( ptoken = strchr( pline+TEXT, PERCENTSUB );
ptoken != NULL;
ptoken = strchr( ptoken + 2, PERCENTSUB ) ) {
if( ptoken[1] == NODESUB ) {
/* Only allow one copy of the pattern;
* otherwise, make it a percent.
* (because we can't pass variable
* number of copies of the nodelist).
*/
*ptoken = '%';
if( !hasnodepattern ) ptoken[1] = 's';
else ptoken[1] = '%';
hasnodepattern = 1;
} else if( ptoken[1] == PERCENTSUB ) {
*ptoken = ptoken[1] = '%';
}
}
if( !hasnodepattern ) {
/* Use separate printfs so the output line
* will be processed by print once in either
* case.
*/
printf( "%s ", nodelist );
printf( pline+TEXT );
} else {
printf( pline+TEXT, nodelist );
}
}
}
}
示例8: Pop
void Pop( Stack S ) {
if (IsEmpty(S))
Error("Stack is empty!");
else
--S->TopOfStack;
}
示例9: NS_PRECONDITION
nsresult
nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
JSObject* aBoundNode,
nsIURI* aBindingDocURI,
bool* aDidInstall) const
{
NS_PRECONDITION(aBoundNode,
"uh-oh, bound node should NOT be null or bad things will "
"happen");
*aDidInstall = false;
// Empty fields are treated as not actually present.
if (IsEmpty()) {
return NS_OK;
}
nsAutoMicroTask mt;
// EvaluateString and JS_DefineUCProperty can both trigger GC, so
// protect |result| here.
nsresult rv;
nsAutoCString uriSpec;
aBindingDocURI->GetSpec(uriSpec);
JSContext* cx = aContext->GetNativeContext();
NS_ASSERTION(!::JS_IsExceptionPending(cx),
"Shouldn't get here when an exception is pending!");
// compile the literal string
nsCOMPtr<nsIScriptContext> context = aContext;
JSAutoRequest ar(cx);
jsval result = JSVAL_NULL;
JS::CompileOptions options(cx);
options.setFileAndLine(uriSpec.get(), mLineNumber)
.setVersion(JSVERSION_LATEST)
.setUserBit(true); // Flag us as XBL
rv = context->EvaluateString(nsDependentString(mFieldText,
mFieldTextLength),
*aBoundNode, options,
/* aCoerceToString = */ false,
&result);
if (NS_FAILED(rv)) {
return rv;
}
// Define the evaluated result as a JS property
nsDependentString name(mName);
if (!::JS_DefineUCProperty(cx, aBoundNode,
reinterpret_cast<const jschar*>(mName),
name.Length(), result, nullptr, nullptr,
mJSAttributes)) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aDidInstall = true;
return NS_OK;
}
示例10:
SqlSet& SqlSet::Cat(const SqlVal& val) {
if(!IsEmpty()) text.Cat(", ");
text.Cat(~val);
priority = SET;
return *this;
}
示例11: CHECK_ERROR
result_t JSHandler::invoke(object_base *v, obj_ptr<Handler_base> &retVal,
AsyncEvent *ac)
{
if (ac)
return CHECK_ERROR(CALL_E_NOASYNC);
v8::Local<v8::Object> o = v->wrap();
Isolate* isolate = holder();
obj_ptr<Message_base> msg = Message_base::getInstance(v);
v8::Local<v8::Value> a = v8::Local<v8::Value>::New(isolate->m_isolate, o);
v8::Local<v8::Value> hdlr = GetPrivate("handler");
while (true)
{
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(hdlr);
obj_ptr<List_base> params;
std::vector<v8::Local<v8::Value> > argv;
v8::Local<v8::Value> *pargv;
int32_t len = 0, i;
if (msg != NULL)
{
msg->get_params(params);
params->get_length(len);
}
if (len > 0)
{
argv.resize(len + 1);
argv[0] = a;
for (i = 0; i < len; i++)
{
Variant v;
params->_indexed_getter(i, v);
argv[i + 1] = v;
}
pargv = argv.data();
}
else
pargv = &a;
{
TryCatch try_catch;
hdlr = func->Call(v8::Undefined(isolate->m_isolate), len + 1, pargv);
if (try_catch.HasCaught())
{
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
isolate->m_isolate, 1, v8::StackTrace::kScriptId);
if (stackTrace->GetFrameCount() > 0)
{
try_catch.ReThrow();
return CALL_E_JAVASCRIPT;
}
else
return CHECK_ERROR(Runtime::setError(GetException(try_catch, 0)));
}
}
if (IsEmpty (hdlr))
return CALL_RETURN_NULL;
if (!hdlr->IsFunction())
{
if (hdlr->IsObject())
return JSHandler::New(hdlr, retVal);
msg->set_result(hdlr);
return CALL_RETURN_NULL;
}
}
return 0;
}
示例12: operator
String SqlSet::operator()(int at) const {
if(IsEmpty()) return "null";
return at > priority ? '(' + text + ')' : text;
}
示例13: RenderDebug
void Chunk::RenderDebug()
{
float l_length = (Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE) - 0.05f;
float l_height = (Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE) - 0.05f;
float l_width = (Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE) - 0.05f;
m_pRenderer->SetRenderMode(RM_WIREFRAME);
m_pRenderer->SetCullMode(CM_NOCULL);
m_pRenderer->SetLineWidth(1.0f);
m_pRenderer->PushMatrix();
m_pRenderer->TranslateWorldMatrix(m_position.x, m_position.y, m_position.z);
m_pRenderer->TranslateWorldMatrix(Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE, Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE, Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE);
m_pRenderer->TranslateWorldMatrix(-Chunk::BLOCK_RENDER_SIZE, -Chunk::BLOCK_RENDER_SIZE, -Chunk::BLOCK_RENDER_SIZE);
m_pRenderer->ImmediateColourAlpha(1.0f, 1.0f, 0.0f, 1.0f);
if (IsEmpty())
{
m_pRenderer->ImmediateColourAlpha(1.0f, 0.0f, 0.0f, 1.0f);
}
else if (IsSurrounded())
{
m_pRenderer->ImmediateColourAlpha(0.0f, 1.0f, 1.0f, 1.0f);
}
m_pRenderer->EnableImmediateMode(IM_QUADS);
m_pRenderer->ImmediateNormal(0.0f, 0.0f, -1.0f);
m_pRenderer->ImmediateVertex(l_length, -l_height, -l_width);
m_pRenderer->ImmediateVertex(-l_length, -l_height, -l_width);
m_pRenderer->ImmediateVertex(-l_length, l_height, -l_width);
m_pRenderer->ImmediateVertex(l_length, l_height, -l_width);
m_pRenderer->ImmediateNormal(0.0f, 0.0f, 1.0f);
m_pRenderer->ImmediateVertex(-l_length, -l_height, l_width);
m_pRenderer->ImmediateVertex(l_length, -l_height, l_width);
m_pRenderer->ImmediateVertex(l_length, l_height, l_width);
m_pRenderer->ImmediateVertex(-l_length, l_height, l_width);
m_pRenderer->ImmediateNormal(1.0f, 0.0f, 0.0f);
m_pRenderer->ImmediateVertex(l_length, -l_height, l_width);
m_pRenderer->ImmediateVertex(l_length, -l_height, -l_width);
m_pRenderer->ImmediateVertex(l_length, l_height, -l_width);
m_pRenderer->ImmediateVertex(l_length, l_height, l_width);
m_pRenderer->ImmediateNormal(-1.0f, 0.0f, 0.0f);
m_pRenderer->ImmediateVertex(-l_length, -l_height, -l_width);
m_pRenderer->ImmediateVertex(-l_length, -l_height, l_width);
m_pRenderer->ImmediateVertex(-l_length, l_height, l_width);
m_pRenderer->ImmediateVertex(-l_length, l_height, -l_width);
m_pRenderer->ImmediateNormal(0.0f, -1.0f, 0.0f);
m_pRenderer->ImmediateVertex(-l_length, -l_height, -l_width);
m_pRenderer->ImmediateVertex(l_length, -l_height, -l_width);
m_pRenderer->ImmediateVertex(l_length, -l_height, l_width);
m_pRenderer->ImmediateVertex(-l_length, -l_height, l_width);
m_pRenderer->ImmediateNormal(0.0f, 1.0f, 0.0f);
m_pRenderer->ImmediateVertex(l_length, l_height, -l_width);
m_pRenderer->ImmediateVertex(-l_length, l_height, -l_width);
m_pRenderer->ImmediateVertex(-l_length, l_height, l_width);
m_pRenderer->ImmediateVertex(l_length, l_height, l_width);
m_pRenderer->DisableImmediateMode();
m_pRenderer->PopMatrix();
m_pRenderer->SetCullMode(CM_BACK);
}
示例14: OnClearUI
void NewBuildTab::OnClearUI(wxUpdateUIEvent& e) { e.Enable(!m_buildInProgress && !IsEmpty()); }
示例15: checkEmpty
int checkEmpty(finsQueue Q) {
return (IsEmpty(Q));
}