当前位置: 首页>>代码示例>>C++>>正文


C++ Null函数代码示例

本文整理汇总了C++中Null函数的典型用法代码示例。如果您正苦于以下问题:C++ Null函数的具体用法?C++ Null怎么用?C++ Null使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Null函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Null

Handle<Value> MultiPolygon::New(OGRMultiPolygon *geom, bool owned)
{
	HandleScope scope;

	if (!geom) {
		return Null();
	}

	//make a copy of geometry owned by a feature
	// + no need to track when a feature is destroyed
	// + no need to throw errors when a method trys to modify an owned read-only geometry
	// - is slower

	if (!owned) {
		geom = static_cast<OGRMultiPolygon*>(geom->clone());
	};

	MultiPolygon *wrapped = new MultiPolygon(geom);
	wrapped->owned_ = true;

	UPDATE_AMOUNT_OF_GEOMETRY_MEMORY(wrapped);

	v8::Handle<v8::Value> ext = v8::External::New(wrapped);
	v8::Handle<v8::Object> obj = MultiPolygon::constructor->GetFunction()->NewInstance(1, &ext);

	return scope.Close(obj);
}
开发者ID:Mofangbao,项目名称:node-gdal,代码行数:27,代码来源:gdal_multipolygon.cpp

示例2: main

int main() {
    Null();

    for (;;);

    return 0;
}
开发者ID:Foshie,项目名称:Classes,代码行数:7,代码来源:null.c

示例3: NODE_THROW

Handle<Value> DatasetBands::get(const Arguments& args)
{
	HandleScope scope;

	Handle<Object> parent = args.This()->GetHiddenValue(String::NewSymbol("parent_"))->ToObject();
	Dataset *ds = ObjectWrap::Unwrap<Dataset>(parent);
	
	if (ds->uses_ogr){
		OGRDataSource* raw = ds->getDatasource();
		if (!raw) {
			return NODE_THROW("Dataset object has already been destroyed");
		}
		return Null();
	} else {
		GDALDataset* raw = ds->getDataset();
		if (!raw) {
			return NODE_THROW("Dataset object has already been destroyed");
		}
		int band_id;
		NODE_ARG_INT(0, "band id", band_id);
	
		GDALRasterBand *band = raw->GetRasterBand(band_id);

		return scope.Close(RasterBand::New(band, raw));
	}
}
开发者ID:Mofangbao,项目名称:node-gdal,代码行数:26,代码来源:dataset_bands.cpp

示例4: while

/// Create - create a fragment reference for a given fragment.
///
/// @param pFrag - the given fragment
/// @param pOffset - the offset, can be larger than the fragment, but can not
///                  be larger than the section size.
/// @return if the offset is legal, return the fragment reference. Otherwise,
/// return NULL.
FragmentRef* FragmentRef::Create(Fragment& pFrag, uint64_t pOffset) {
  int64_t offset = pOffset;
  Fragment* frag = &pFrag;

  while (frag != NULL) {
    offset -= frag->size();
    if (offset <= 0)
      break;
    frag = frag->getNextNode();
  }
  if ((frag != NULL) && (frag->size() != 0)) {
    if (offset == 0)
      frag = frag->getNextNode();
    else
      offset += frag->size();
  }

  if (frag == NULL)
    return Null();

  FragmentRef* result = g_FragRefFactory->allocate();
  new (result) FragmentRef(*frag, offset);

  return result;
}
开发者ID:ChihMin,项目名称:mclinker,代码行数:32,代码来源:FragmentRef.cpp

示例5: Null

Handle<Value> FieldDefn::New(OGRFieldDefn *def, bool owned)
{
	HandleScope scope;

	if (!def) {
		return Null();
	}

	//make a copy of fielddefn owned by a featuredefn
	// + no need to track when a featuredefn is destroyed
	// + no need to throw errors when a method trys to modify an owned read-only fielddefn
	// - is slower

	if (!owned) {
		def = new OGRFieldDefn(def);
	}

	FieldDefn *wrapped = new FieldDefn(def);
	wrapped->owned_ = true;

	v8::Handle<v8::Value> ext = v8::External::New(wrapped);
	v8::Handle<v8::Object> obj = FieldDefn::constructor->GetFunction()->NewInstance(1, &ext);

	return scope.Close(obj);
}
开发者ID:Mofangbao,项目名称:node-gdal,代码行数:25,代码来源:gdal_field_defn.cpp

示例6: OnServiceRegistered

static
void
OnServiceRegistered(DNSServiceRef sdRef, DNSServiceFlags flags,
        DNSServiceErrorType errorCode, const char * name, const char * regtype,
        const char * domain, void * context)
{
    if ( ! context) return;

    HandleScope scope;
    ServiceRef * serviceRef = static_cast<ServiceRef*>(context);
    Handle<Function> callback = serviceRef->GetCallback();
    Handle<Object> this_ = serviceRef->GetThis();

    if ( ! callback.IsEmpty() && ! this_.IsEmpty()) {
        const size_t argc(7);
        Local<Value> args[argc];
        args[0] = Local<Object>::New(serviceRef->handle_);
        args[1] = Integer::New(flags);
        args[2] = Integer::New(errorCode);
        args[3] = String::New(name);
        args[4] = String::New(regtype);
        args[5] = String::New(domain);
        if (serviceRef->GetContext().IsEmpty()) {
            args[6] = Local<Value>::New(Null());
        } else {
            args[6] = Local<Value>::New(serviceRef->GetContext());
        }
        callback->Call(this_, argc, args);
    }
}
开发者ID:baiyunping333,项目名称:node_mdns,代码行数:30,代码来源:dns_service_register.cpp

示例7: ThrowException

Handle<Value> Projection::Transform(const Arguments& args)
{
    HandleScope     scope;
    Handle<Value>   geom_obj;
    
    if (args.Length() < 3) {
        return ThrowException(String::New("Not enough arguments."));
    }
    else {
        Projection          *from   = ObjectWrap::Unwrap<Projection>(args[0]->ToObject());
        Projection          *to     = ObjectWrap::Unwrap<Projection>(args[1]->ToObject());
        Geometry            *geom   = ObjectWrap::Unwrap<Geometry>(args[2]->ToObject());
        PointTransformer    *trans  = new ProjectionPointTransformer(from->pj, to->pj);
        
        try {
            geom->ApplyPointTransformation(trans);
        }
        catch (TransformerException ex) {
            delete trans;
            return ThrowException(String::New(ex.GetDescription()));
        }
        
        delete trans;
    }
    
    return scope.Close(Null());
}
开发者ID:netconstructor,项目名称:node-geos,代码行数:27,代码来源:projection.cpp

示例8: si_make_foreign_data_from_array

cl_object
si_make_foreign_data_from_array(cl_object array)
{
	cl_object tag;
	if (ecl_unlikely(ecl_t_of(array) != t_array && ecl_t_of(array) != t_vector)) {
                FEwrong_type_only_arg(ecl_make_fixnum(/*SI::MAKE-FOREIGN-DATA-FROM-ARRAY*/1358), array,
                                      ecl_make_fixnum(/*ARRAY*/96));
	}
        tag = ecl_aet_to_ffi_table[array->array.elttype];
        if (ecl_unlikely(Null(tag))) {
		FEerror("Cannot make foreign object from array "
                        "with element type ~S.", 1,
                        ecl_elttype_to_symbol(array->array.elttype));
	}
	{
#line 293
		const cl_env_ptr the_env = ecl_process_env();
#line 293
		#line 293
		cl_object __value0 = ecl_make_foreign_data(tag, 0, array->array.self.bc);
#line 293
		the_env->nvalues = 1;
#line 293
		return __value0;
#line 293
	}
;
}
开发者ID:hoobaa,项目名称:mecl,代码行数:28,代码来源:ffi.o.c

示例9: Null

Handle<Value> FeatureDefn::New(OGRFeatureDefn *def, bool owned)
{
	HandleScope scope;

	if (!def) {
		return Null();
	}

	//make a copy of featuredefn owned by a layer
	// + no need to track when a layer is destroyed
	// + no need to throw errors when a method trys to modify an owned read-only featuredefn
	// - is slower
	
	//TODO: cloning maybe unnecessary if reference counting is done right. 
	//      def->Reference(); def->Release(); 

	if (!owned) {
		def = def->Clone();
	}

	FeatureDefn *wrapped = new FeatureDefn(def);
	wrapped->owned_ = true;
	def->Reference();

	v8::Handle<v8::Value> ext = v8::External::New(wrapped);
	v8::Handle<v8::Object> obj = FeatureDefn::constructor->GetFunction()->NewInstance(1, &ext);

	return scope.Close(obj);
}
开发者ID:Mofangbao,项目名称:node-gdal,代码行数:29,代码来源:gdal_feature_defn.cpp

示例10: GetFromMemory

CPointer CObjects::Get(char* szObjectName)
{
	CBaseObject*	pvObject;
	CPointer		pObject;

	pvObject = GetFromMemory(szObjectName);
	if (pvObject)
	{
		pObject.AssignObject(pvObject);
		return pObject;
	}

	pvObject = GetFromDatabase(szObjectName);
	if (pvObject)
	{
		pObject.AssignObject(pvObject);
		return pObject;
	}

	pvObject = GetFromSources(szObjectName);
	if (pvObject)
	{
		pObject.AssignObject(pvObject);
		return pObject;
	}

	return Null();
}
开发者ID:chrisjaquet,项目名称:Codaphela.Library,代码行数:28,代码来源:Objects.cpp

示例11: OptionalNull

static Result
OptionalNull(Reader& input)
{
  if (input.Peek(NULLTag)) {
    return Null(input);
  }
  return Success;
}
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:8,代码来源:pkixder.cpp

示例12: NroBuilder

/* arg0: Ndb 
   arg1: NdbDictionary::Table
   arg2: resolvedMapping 
     which contains an array "fields"
     where each element has "columnName" and "fieldName" properties
   
   Returns: a constructor function that can be used to create native-backed 
   objects
*/
Handle<Value> NroBuilder(const Arguments &args) {
  DEBUG_MARKER(UDEB_DEBUG);
  HandleScope scope;
  //Ndb * ndb =  unwrapPointer<Ndb *>(args[0]->ToObject());
  //Handle<Object> jsDbTable = args[1]->ToObject();
  //NdbDictionary::Table * table = unwrapPointer<NdbDictionary::Table *>(jsDbTable);
  
  return scope.Close(Null()); //fixme
}
开发者ID:vsemaphore,项目名称:mysql-js,代码行数:18,代码来源:NdbRecordObject.cpp

示例13: fs_stat

static JSVAL fs_stat(JSARGS args) {
    HandleScope scope;
    String::Utf8Value path(args[0]->ToString());
    struct stat buf;
    if (stat(*path, &buf) == -1) {
        return scope.Close(Null());
    }
    return scope.Close(format_stat(buf));
}
开发者ID:kyusof,项目名称:SilkJS,代码行数:9,代码来源:fs.cpp

示例14: ecl_symbol_type

int
ecl_symbol_type(cl_object s)
{
        if (Null(s))
                return ECL_NIL_SYMBOL->symbol.stype;
        if (ecl_t_of(s) == t_symbol)
                return s->symbol.stype;
        FEwrong_type_nth_arg(ecl_make_fixnum(/*SYMBOL-NAME*/843), 1, s, ecl_make_fixnum(/*SYMBOL*/840));
}
开发者ID:hoobaa,项目名称:mecl,代码行数:9,代码来源:symbol.o.c

示例15: Null

int EBuffer::BlockUnmark() {
    EPoint Null(-1,-1);

    SetBB(BE);
    SetBE(Null);
    SetBB(Null);
    AutoExtend = 0;
    return 1;
}
开发者ID:OS2World,项目名称:APP-EDITOR-fte,代码行数:9,代码来源:e_block.cpp


注:本文中的Null函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。