本文整理汇总了C++中create_object函数的典型用法代码示例。如果您正苦于以下问题:C++ create_object函数的具体用法?C++ create_object怎么用?C++ create_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: args
void ThriftBuffer::read(char *data, int len) {
int avail = m_pEnd - m_p;
// still enough
if (avail >= len) {
if (data) memcpy(data, m_p, len);
if ((m_p += len) > m_pSafe) m_safe = false;
return;
}
if (data) memcpy(data, m_p, avail);
len -= avail;
data += avail;
Array args(CREATE_VECTOR1(BUFFER_SIZE));
while (true) {
String ret = m_xin->o_invoke("read", args, -1).toString();
if (ret.empty()) {
Object e = create_object("TProtocolException",
CREATE_VECTOR2("unable to read enough bytes",
INVALID_DATA));
throw e;
}
const char *rdata = ret.data();
int rsize = ret.size();
if (rsize >= len) {
if (data) memcpy(data, rdata, len);
rsize -= len;
if (rsize) {
memcpy(m_buf, rdata + len, rsize);
m_pEnd = m_buf + rsize;
} else {
m_pEnd = m_buf;
}
m_pSafe = m_pEnd - sizeof(int64) - 1;
m_p = m_buf;
if (m_p > m_pSafe) m_safe = false;
return; // done
}
if (data) memcpy(data, rdata, rsize);
len -= rsize;
data += rsize;
}
}
开发者ID:huichen,项目名称:hiphop-php,代码行数:47,代码来源:thrift_buffer.cpp
示例2: test_send_objects_async
static void
test_send_objects_async (ETestServerFixture *fixture,
gconstpointer user_data)
{
ECalClient *cal_client;
icalcomponent *icalcomp;
cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
icalcomp = create_object ();
g_assert (icalcomp);
e_cal_client_send_objects (cal_client, icalcomp, NULL, async_send_result_ready, fixture->loop);
icalcomponent_free (icalcomp);
g_main_loop_run (fixture->loop);
}
开发者ID:pwithnall,项目名称:evolution-data-server,代码行数:17,代码来源:test-cal-client-send-objects.c
示例3: create_activex_constr
HRESULT create_activex_constr(script_ctx_t *ctx, jsdisp_t **ret)
{
jsdisp_t *prototype;
HRESULT hres;
static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0};
hres = create_object(ctx, NULL, &prototype);
if(FAILED(hres))
return hres;
hres = create_builtin_function(ctx, ActiveXObject_value, ActiveXObjectW, NULL,
PROPF_CONSTR|1, prototype, ret);
jsdisp_release(prototype);
return hres;
}
开发者ID:GYGit,项目名称:reactos,代码行数:17,代码来源:activex.c
示例4: make_generalization_inside_large_package
std::array<processed_object, 4> mock_processed_object_factory::
make_generalization_inside_large_package(
unsigned int n, const std::string& st) {
std::array<processed_object, 4> r = {{
make_large_package(n),
make_class(++n, st),
make_class(++n, st),
create_object(object_types::uml_generalization, ++n)
}};
r[3].connection(std::make_pair(r[1].id(), r[2].id()));
r[1].child_node_id(r[0].id());
r[2].child_node_id(r[0].id());
r[3].child_node_id(r[0].id());
return r;
}
开发者ID:pgannon,项目名称:dogen,代码行数:17,代码来源:mock_processed_object_factory.cpp
示例5: HHVM_METHOD
static Variant HHVM_METHOD(MongoCollection, insert, Variant a, Array options) {
mongoc_collection_t *collection;
bson_t doc;
bson_error_t error;
collection = get_collection(this_);
Array& doc_array = a.toArrRef();
if (!doc_array.exists(String("_id"))) {
const StaticString s_MongoId("MongoId");
char id[25];
bson_oid_t oid;
bson_oid_init(&oid, NULL);
bson_oid_to_string(&oid, id);
ObjectData * data = create_object(&s_MongoId, make_packed_array(String(id)));
doc_array.add(String("_id"), data);
}
encodeToBSON(doc_array, &doc);
int w_flag = MONGOC_WRITE_CONCERN_W_DEFAULT;
//如果传递了参数
mongoc_write_concern_t *write_concern;
write_concern = mongoc_write_concern_new();
mongoc_write_concern_set_w(write_concern, w_flag);
bool ret = mongoc_collection_insert(collection, MONGOC_INSERT_NONE, &doc, write_concern, &error);
if (!ret) {
mongoThrow<MongoCursorException>((const char *) error.message);
}
mongoc_collection_destroy(collection);
bson_destroy(&doc);
return ret;
/*
bool mongoc_collection_insert (mongoc_collection_t *collection,
mongoc_insert_flags_t flags,
const bson_t *document,
const mongoc_write_concern_t *write_concern,
bson_error_t *error);
*/
}
开发者ID:110035,项目名称:mongo-hhvm-driver,代码行数:45,代码来源:MongoCollection.cpp
示例6: all_artefact_from_char
//na przyklad jak cialko sie robi, to calkiem z listy wywala
//ownera ale zostaje na mudzie artef. count sie nie zmienia
void all_artefact_from_char( CHAR_DATA *ch )
{
ARTEFACT_DATA * atmp = NULL;
ARTEFACT_OWNER *otmp, *prev = NULL;
OBJ_DATA *obj = NULL;
for ( atmp = artefact_system;atmp;atmp = atmp->next )
{
otmp = atmp->first_owner;
for ( ;otmp; )
{
if ( !strcmp( ch->name, otmp->owner ) )
{
if ( prev != NULL )
prev->next = otmp->next;
else
atmp->first_owner = otmp->next;
obj = create_object( get_obj_index( atmp->avnum ), FALSE );
wiznet( "$N STRACIL(a) artefact : $p.", ch, obj, WIZ_ARTEFACT, 0, get_trust( ch ) );
append_file_format_daily( ch, ARTEFACT_LOG_FILE, "-> STRACIL (zgon):%s vnum:%d count:%d max: %d (move)", obj->short_descr, atmp->avnum, atmp->count, atmp->max_count );
extract_obj( obj );
otmp->next = NULL;
free_artefact_owner( otmp );
//nastepny element
if ( prev != NULL )
otmp = prev->next;
else
otmp = atmp->first_owner;
}
else //to nie ten
{
prev = otmp;
otmp = otmp->next;
}
}
}
}
开发者ID:Tener,项目名称:KillerMUD,代码行数:47,代码来源:artefact.c
示例7: test_send_objects_sync
static void
test_send_objects_sync (ETestServerFixture *fixture,
gconstpointer user_data)
{
ECalClient *cal_client;
GError *error = NULL;
icalcomponent *icalcomp, *modified_icalcomp = NULL;
GSList *users = NULL;
cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
icalcomp = create_object ();
if (!e_cal_client_send_objects_sync (cal_client, icalcomp, &users, &modified_icalcomp, NULL, &error))
g_error ("send objects sync: %s", error->message);
icalcomponent_free (icalcomp);
manage_result (users, modified_icalcomp);
}
开发者ID:pwithnall,项目名称:evolution-data-server,代码行数:18,代码来源:test-cal-client-send-objects.c
示例8: cbson_loads_visit_dbpointer
static bool
cbson_loads_visit_dbpointer (const bson_iter_t *iter,
const char *key,
size_t v_collection_len,
const char *v_collection,
const bson_oid_t *v_oid,
void *output)
{
char id[25];
bson_oid_to_string(v_oid, id);
ObjectData * data = create_object(&s_MongoDBRef,
make_packed_array(
String(v_collection, v_collection_len, CopyString),
String(id)));
((Array *)output)->add(String(key), data);
return false;
//TODO: Finish this
}
开发者ID:110035,项目名称:mongo-hhvm-driver,代码行数:18,代码来源:bson_decode.cpp
示例9: test_remove_object_sync
static void
test_remove_object_sync (ETestServerFixture *fixture,
gconstpointer user_data)
{
ECalClient *cal_client;
GError *error = NULL;
gchar *uid;
cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
uid = create_object (cal_client);
g_assert (uid != NULL);
if (!e_cal_client_remove_object_sync (cal_client, uid, NULL, E_CAL_OBJ_MOD_ALL, NULL, &error))
g_error ("remove object sync: %s", error->message);
g_free (uid);
}
开发者ID:pwithnall,项目名称:evolution-data-server,代码行数:18,代码来源:test-cal-client-remove-object.c
示例10: create_source_function
HRESULT create_source_function(parser_ctx_t *ctx, parameter_t *parameters, source_elements_t *source,
scope_chain_t *scope_chain, const WCHAR *src_str, DWORD src_len, DispatchEx **ret)
{
FunctionInstance *function;
DispatchEx *prototype;
parameter_t *iter;
DWORD length = 0;
HRESULT hres;
hres = create_object(ctx->script, NULL, &prototype);
if(FAILED(hres))
return hres;
hres = create_function(ctx->script, NULL, PROPF_CONSTR, FALSE, NULL, &function);
if(SUCCEEDED(hres)) {
hres = set_prototype(ctx->script, &function->dispex, prototype);
if(FAILED(hres))
jsdisp_release(&function->dispex);
}
jsdisp_release(prototype);
if(FAILED(hres))
return hres;
function->source = source;
function->parameters = parameters;
if(scope_chain) {
scope_addref(scope_chain);
function->scope_chain = scope_chain;
}
parser_addref(ctx);
function->parser = ctx;
for(iter = parameters; iter; iter = iter->next)
length++;
function->length = length;
function->src_str = src_str;
function->src_len = src_len;
*ret = &function->dispex;
return S_OK;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:44,代码来源:function.c
示例11: init_player
void init_player(void){
ski_player.actor = create_object(OBJ_TYPE_PLAYER);
ski_player.actor->x = SCREEN_CENTER_W;
/*
load texture for ski player (sprite sheets)
*/
object_set_texture(&ski_player.actor, player_assets[0]);
/*
debug mode render sa borders in the texture
*/
#ifdef DEBUG_MODE
texture_set_flags(ski_player.actor->sprite, TEXTURE_SHOW_BORDER);
#endif
/*
if (DEBUG_MODE) {
ski_player.actor->sprite->debug_texture = TEXTURE_SHOW_BORDER;
}
else {
ski_player.actor->sprite->debug_texture = TEXTURE_NO_DEBUG;
}
*/
ski_player.lives = 3;
ski_player.health= 100;
ski_player.player_movement_state = STATE_PLAYER_STATE_STOPPED;
ski_player.actor->delay = 0;
ski_player.key_active = 1;
if(ski_player.actor->sprite->spritesheet != NULL) al_convert_mask_to_alpha( ski_player.actor->sprite->spritesheet, al_map_rgb(255,0,255));
}
开发者ID:ryonagana,项目名称:skiOS,代码行数:43,代码来源:player.c
示例12: git_repository_newobject
int git_repository_newobject(git_object **object_out, git_repository *repo, git_otype type)
{
git_object *object = NULL;
int error;
assert(object_out && repo);
if ((error = create_object(&object, type)) < GIT_SUCCESS)
return error;
object->repo = repo;
object->in_memory = 1;
object->modified = 1;
object->source.raw.type = type;
*object_out = object;
return GIT_SUCCESS;
}
开发者ID:peterarmstrong,项目名称:libgit2,代码行数:19,代码来源:repository.c
示例13: test_sync
static gboolean
test_sync (ECalClient *cal_client)
{
GError *error = NULL;
icalcomponent *icalcomp, *modified_icalcomp = NULL;
GSList *users = NULL;
icalcomp = create_object ();
if (!e_cal_client_send_objects_sync (cal_client, icalcomp, &users, &modified_icalcomp, NULL, &error)) {
report_error ("send objects sync", &error);
icalcomponent_free (icalcomp);
return FALSE;
}
icalcomponent_free (icalcomp);
return manage_result (users, modified_icalcomp);
}
开发者ID:gcampax,项目名称:evolution-data-server,代码行数:19,代码来源:test-client-send-objects.c
示例14: main
int main()
{
double c, d ;
int errcode ;
struct SomeObject *objptr ;
c = calculate_something(42, 98.6) ;
if ((errcode = error_code()) != 0) {
/* fprintf(stderr, "error calculating something: %d\n", errcode); */
return 1;
}
objptr = create_object("my object") ;
d = calculate_something_else(c, objptr) ;
free_object(objptr) ;
/* fprintf(stdout, "calculated %f\n", d); */
return 0;
}
开发者ID:kernelzin,项目名称:xxpub,代码行数:19,代码来源:main.c
示例15: handle_waterwheel_destruction
void handle_waterwheel_destruction(OBJ_DATA & obj)
{
// Verify a room
ROOM_INDEX_DATA * room(get_room_for_obj(obj));
if (room == NULL)
return;
// Load up the remains and transfer the contents
OBJ_DATA * remains(create_object(get_obj_index(OBJ_VNUM_WATERWHEEL_REMAINS), 0));
remains->level = obj.level;
for (OBJ_DATA * item(obj.contains); item != NULL; item = obj.contains)
{
obj_from_obj(item);
obj_to_obj(item, remains);
}
obj_to_room(remains, room);
}
开发者ID:justinabrahms,项目名称:avendar,代码行数:19,代码来源:spells_water_earth.c
示例16: spec_auth
bool spec_auth( CHAR_DATA * ch )
{
CHAR_DATA *victim;
CHAR_DATA *v_next;
char buf[MAX_STRING_LENGTH];
OBJ_INDEX_DATA *pObjIndex;
OBJ_DATA *obj;
bool hasdiploma;
for( victim = ch->in_room->first_person; victim; victim = v_next )
{
v_next = victim->next_in_room;
if( !IS_NPC( victim ) && ( pObjIndex = get_obj_index( OBJ_VNUM_SCHOOL_DIPLOMA ) ) != NULL )
{
hasdiploma = FALSE;
for( obj = victim->last_carrying; obj; obj = obj->prev_content )
if( obj->pIndexData == get_obj_index( OBJ_VNUM_SCHOOL_DIPLOMA ) )
hasdiploma = TRUE;
if( !hasdiploma )
{
obj = create_object( pObjIndex, 1 );
obj = obj_to_char( obj, victim );
send_to_char( "&cThe schoolmaster gives you a diploma, and shakes your hand.\r\n&w", victim );
}
}
if( IS_NPC( victim ) || !IS_SET( victim->pcdata->flags, PCFLAG_UNAUTHED ) )
continue;
victim->pcdata->auth_state = 3;
REMOVE_BIT( victim->pcdata->flags, PCFLAG_UNAUTHED );
if( victim->pcdata->authed_by )
STRFREE( victim->pcdata->authed_by );
victim->pcdata->authed_by = QUICKLINK( ch->name );
sprintf( buf, "%s authorized %s", ch->name, victim->name );
to_channel( buf, CHANNEL_MONITOR, "Monitor", ch->top_level );
}
return FALSE;
}
开发者ID:AndrewBudd,项目名称:swr-fuss-ace,代码行数:42,代码来源:special.c
示例17: do_bank_open
void do_bank_open(Character *ch, char *argument)
{
OBJ_DATA *obj;
if ( ( obj = get_obj_carry( ch, (char*)"bank note", ch ) ) != NULL )
{
send_to_char( "You already own a bank note.\n\r", ch );
return;
}
if (ch->gold < 10)
{
send_to_char("It costs 10 gold to open an account.\n\r", ch);
return;
}
ch->gold -= 10;
obj_to_char(create_object(get_obj_index(OBJ_VNUM_BANK_NOTE),0),ch);
send_to_char("Enjoy your bank note.\n\r", ch);
return;
}
开发者ID:Swiftam,项目名称:ForgottenLegends,代码行数:20,代码来源:bank.cpp
示例18: number_range
* load_quest_object : This takes a pointer to OBJ_INDEX_DATA and places the
* object onto the target.
*/
OBJ_DATA *load_quest_object( CHAR_DATA *target )
{
OBJ_INDEX_DATA *pObj;
OBJ_DATA *object;
int foo;
foo = number_range( OBJ_VNUM_QUEST_MIN, OBJ_VNUM_QUEST_MAX );
pObj = get_obj_index( foo );
if ( pObj == NULL )
{
bug( "load_quest_object : Invalid object vnum %d.", foo );
return NULL;
}
object = create_object( pObj, 1 );
obj_to_char( object, target );
return object;
}
开发者ID:MikeMayer,项目名称:act-of-war,代码行数:25,代码来源:quest.c
示例19: test_indent
static void test_indent()
{
json_t *object;
json_t *array;
char *result;
object = create_object();
array = create_array();
result = json_dumps(object, JSON_INDENT(4));
if(strcmp(result, INDENTED_OBJECT) != 0)
fail("unexpected encoded object");
free(result);
result = json_dumps(array, JSON_INDENT(4));
if(strcmp(result, INDENTED_ARRAY) != 0)
fail("unexpected encoded array");
free(result);
json_decref(object);
json_decref(array);
}
开发者ID:fugalh,项目名称:jansson,代码行数:22,代码来源:test_dump.c
示例20: get_process_winstation
/* retrieve the clipboard info for the current process, allocating it if needed */
static struct clipboard *get_process_clipboard(void)
{
NTSTATUS status;
struct clipboard *clipboard;
struct winstation *winstation = get_process_winstation(get_current_w32process(), WINSTA_ACCESSCLIPBOARD);
if (!winstation) {
ktrace("get_process_winstation return NULL!\n");
return NULL;
}
if (!(clipboard = winstation->clipboard)) {
status = create_object(KernelMode,
clipboard_object_type,
NULL /* obj_attr*/,
KernelMode,
NULL,
sizeof(struct clipboard),
0,
0,
(PVOID *)&clipboard);
if (NT_SUCCESS(status) && clipboard) {
INIT_DISP_HEADER(&clipboard->obj.header, CLIPBOARD,
sizeof(struct clipboard) / sizeof(ULONG), 0);
BODY_TO_HEADER(&(clipboard->obj))->ops = &clipboard_ops;
clipboard->open_thread = NULL;
clipboard->open_win = 0;
clipboard->owner_thread = NULL;
clipboard->owner_win = 0;
clipboard->viewer = 0;
clipboard->seqno = 0;
clipboard->seqno_timestamp = 0;
winstation->clipboard = clipboard;
}
}
release_object(winstation);
return clipboard;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:40,代码来源:clipboard.c
注:本文中的create_object函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论