本文整理汇总了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);
}
示例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));
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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());
}
示例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
}
;
}
示例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);
}
示例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();
}
示例11: OptionalNull
static Result
OptionalNull(Reader& input)
{
if (input.Peek(NULLTag)) {
return Null(input);
}
return Success;
}
示例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
}
示例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));
}
示例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));
}
示例15: Null
int EBuffer::BlockUnmark() {
EPoint Null(-1,-1);
SetBB(BE);
SetBE(Null);
SetBB(Null);
AutoExtend = 0;
return 1;
}