本文整理汇总了C++中Null函数的典型用法代码示例。如果您正苦于以下问题:C++ Null函数的具体用法?C++ Null怎么用?C++ Null使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Null函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ecl_symbol_package
cl_object
ecl_symbol_package(cl_object s)
{
if (Null(s))
return ECL_NIL_SYMBOL->symbol.hpack;
if (ecl_t_of(s) == t_symbol)
return s->symbol.hpack;
FEwrong_type_nth_arg(ecl_make_fixnum(/*SYMBOL-PACKAGE*/844), 1, s, ecl_make_fixnum(/*SYMBOL*/840));
}
开发者ID:hoobaa,项目名称:mecl,代码行数:9,代码来源:symbol.o.c
示例17: getScalar
JSVAL getScalar(JSARGS args) {
HandleScope scope;
String::Utf8Value sql(args[0]->ToString());
int failure = mysql_query(handle, *sql);
if (failure) {
return ThrowException(Exception::Error(String::New(mysql_error(handle))));
}
MYSQL_RES *result = mysql_store_result(handle);
if (!result) {
return scope.Close(False());
}
unsigned long *lengths = mysql_fetch_lengths(result);
MYSQL_FIELD *fields = mysql_fetch_fields(result);
MYSQL_ROW row = mysql_fetch_row(result);
if (row[0] == NULL) {
return Null();
}
else {
switch (fields[0].type) {
case MYSQL_TYPE_TINY:
return scope.Close(Integer::New(atoi(row[0])));
case MYSQL_TYPE_SHORT:
return scope.Close(Integer::New(atoi(row[0])));
case MYSQL_TYPE_LONG:
return scope.Close(Integer::New(atoi(row[0])));
case MYSQL_TYPE_FLOAT:
return scope.Close(Integer::New(atoi(row[0])));
case MYSQL_TYPE_DOUBLE:
return scope.Close(Integer::New(atoi(row[0])));
case MYSQL_TYPE_NULL:
return Null();
case MYSQL_TYPE_TIMESTAMP:
return scope.Close(Integer::New(atoi(row[0])));
case MYSQL_TYPE_LONGLONG:
return scope.Close(Integer::New(atoi(row[0])));
case MYSQL_TYPE_INT24:
return scope.Close(Integer::New(atoi(row[0])));
default:
return scope.Close(String::New(row[0], lengths[0]));
}
}
}
开发者ID:sequoiar,项目名称:SilkJS,代码行数:44,代码来源:mysql.cpp
示例18: LOGD
Handle<Value> PushbotsModule::getter_exampleProp(Local<String> property, const AccessorInfo& info)
{
LOGD(TAG, "get exampleProp");
HandleScope scope;
JNIEnv *env = titanium::JNIScope::getEnv();
if (!env) {
return titanium::JSException::GetJNIEnvironmentError();
}
static jmethodID methodID = NULL;
if (!methodID) {
methodID = env->GetMethodID(PushbotsModule::javaClass, "getExampleProp", "()Ljava/lang/String;");
if (!methodID) {
const char *error = "Couldn't find proxy method 'getExampleProp' with signature '()Ljava/lang/String;'";
LOGE(TAG, error);
return titanium::JSException::Error(error);
}
}
titanium::Proxy* proxy = titanium::Proxy::unwrap(info.Holder());
if (!proxy) {
return Undefined();
}
jvalue* jArguments = 0;
jobject javaProxy = proxy->getJavaObject();
jstring jResult = (jstring)env->CallObjectMethodA(javaProxy, methodID, jArguments);
if (!JavaObject::useGlobalRefs) {
env->DeleteLocalRef(javaProxy);
}
if (env->ExceptionCheck()) {
Handle<Value> jsException = titanium::JSException::fromJavaException();
env->ExceptionClear();
return jsException;
}
if (jResult == NULL) {
return Null();
}
Handle<Value> v8Result = titanium::TypeConverter::javaStringToJsString(env, jResult);
env->DeleteLocalRef(jResult);
return v8Result;
}
开发者ID:appcelerator-forks,项目名称:drmas.Pushbots,代码行数:56,代码来源:com.pushbots.android.PushbotsModule.cpp
示例19: EIO_AfterEncode
void Grid::EIO_AfterEncode(uv_work_t* req)
{
HandleScope scope;
encode_grid_baton_t *closure = static_cast<encode_grid_baton_t *>(req->data);
TryCatch try_catch;
if (closure->error) {
Local<Value> argv[1] = { Exception::Error(String::New(closure->error_name.c_str())) };
closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
// convert key order to proper javascript array
Local<Array> keys_a = Array::New(closure->key_order.size());
std::vector<std::string>::iterator it;
unsigned int i;
for (it = closure->key_order.begin(), i = 0; it < closure->key_order.end(); ++it, ++i)
{
keys_a->Set(i, String::New((*it).c_str()));
}
mapnik::grid const& grid_type = *closure->g->get();
// gather feature data
Local<Object> feature_data = Object::New();
if (closure->add_features) {
node_mapnik::write_features<mapnik::grid>(grid_type,
feature_data,
closure->key_order);
}
// Create the return hash.
Local<Object> json = Object::New();
Local<Array> grid_array = Array::New(closure->lines.size());
unsigned array_size = static_cast<unsigned int>(grid_type.width()/closure->resolution);
for (unsigned j=0;j<closure->lines.size();++j)
{
grid_array->Set(j,String::New(&closure->lines[j],array_size));
}
json->Set(String::NewSymbol("grid"), grid_array);
json->Set(String::NewSymbol("keys"), keys_a);
json->Set(String::NewSymbol("data"), feature_data);
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(json) };
closure->cb->Call(Context::GetCurrent()->Global(), 2, argv);
}
if (try_catch.HasCaught()) {
FatalException(try_catch);
}
uv_unref(uv_default_loop());
closure->g->Unref();
closure->cb.Dispose();
delete closure;
}
开发者ID:Maplecroft,项目名称:node-mapnik,代码行数:56,代码来源:mapnik_grid.cpp
示例20: fs_readfile64
static JSVAL fs_readfile64(JSARGS args) {
HandleScope scope;
String::Utf8Value path(args[0]->ToString());
int fd = open(*path, O_RDONLY);
if (fd == -1) {
printf("%s\n%s\n", *path, strerror(errno));
return scope.Close(Null());
}
long size = lseek(fd, 0, 2);
lseek(fd, 0, 0);
unsigned char buf[size];
if (read(fd, buf, size) != size) {
return scope.Close(Null());
}
close(fd);
string encoded = Base64Encode(buf, size);
Handle<String>s = String::New(encoded.c_str(), encoded.size());
return scope.Close(s);
}
开发者ID:kyusof,项目名称:SilkJS,代码行数:19,代码来源:fs.cpp
注:本文中的Null函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论