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


C++ Resource函数代码示例

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


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

示例1: addImageToResources

void PageSerializer::addImageToResources(CachedImage* image, const KURL& url)
{
    if (!url.isValid() || m_resourceURLs.contains(url))
        return;

    if (!image || image->image() == Image::nullImage())
        return;

    String mimeType = image->response().mimeType();
    m_resources->append(Resource(url, mimeType, image->image()->data()));
    m_resourceURLs.add(url);
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:12,代码来源:PageSerializer.cpp

示例2: Resource

std::map<Resource,int> City::get_luxuries(Luxury_type type)
{
  std::map<Resource,int> ret;

  for (int i = 0; i < RES_MAX; i++) {
    if (resources[i] > 1 && Resource_data[i]->luxury_type == type) {
      ret[ Resource(i) ] = resources[i];
    }
  }

  return ret;
}
开发者ID:Whales,项目名称:edigotia,代码行数:12,代码来源:city.cpp

示例3: ResourceData

Resource ResourceTracker::RegisterResource(const std::string& name,
		void* resourceData)
{
	ResourceData* data =
		new ResourceData(resourceData, this, name);
	
	m_resourceMap[name] = data;

	// Remove the reference from our pointer
	data->RemoveReference();
	return Resource(data);
}
开发者ID:BennyQBD,项目名称:Experiments,代码行数:12,代码来源:resourceTracker.cpp

示例4: createInstance

  Resource createInstance(const char* php_func,
                          const Resource& stream,
                          const String& filter,
                          const Variant& params) {
    auto class_name = m_registeredFilters.rvalAt(filter).asCStrRef();
    Class* class_ = Unit::getClass(class_name.get(), true);
    Object obj = Object();

    if (LIKELY(class_ != nullptr)) {
      PackedArrayInit ctor_args(3);
      ctor_args.append(stream);
      ctor_args.append(filter);
      ctor_args.append(params);
      obj = g_context->createObject(class_name.get(), ctor_args.toArray());
      auto created = obj->o_invoke(s_onCreate, Array::Create());
      /* - true: documented value for success
       * - null: undocumented default successful value
       * - false: documented value for failure
       */
      if (!(created.isNull() || created.toBoolean())) {
        obj.reset();
      }
    } else {
      raise_warning("%s: user-filter \"%s\" requires class \"%s\", but that "
                    "class " "is not defined",
                    php_func,
                    filter.data(),
                    class_name.data());
      // Fall through, as to match Zend, the warning below should also be raised
    }

    if (obj.isNull()) {
      raise_warning("%s: unable to create or locate filter \"%s\"",
                    php_func,
                    filter.data());
      return Resource();
    }

    return Resource(newres<StreamFilter>(obj, stream));
  }
开发者ID:Debug-Orz,项目名称:hhvm,代码行数:40,代码来源:ext_stream-user-filters.cpp

示例5: HHVM_FUNCTION

bool HHVM_FUNCTION(socket_create_pair,
                   int domain,
                   int type,
                   int protocol,
                   VRefParam fd) {
  check_socket_parameters(domain, type);

  int fds_array[2];
  if (socketpair(domain, type, protocol, fds_array) != 0) {
    Socket dummySock; // for setting last socket error
    SOCKET_ERROR((&dummySock), "unable to create socket pair", errno);
    return false;
  }

  fd = make_packed_array(
    Resource(new Socket(fds_array[0], domain, nullptr, 0, 0.0,
                        s_socktype_generic)),
    Resource(new Socket(fds_array[1], domain, nullptr, 0, 0.0,
                        s_socktype_generic))
  );
  return true;
}
开发者ID:RyanCccc,项目名称:hhvm,代码行数:22,代码来源:ext_sockets.cpp

示例6: HHVM_METHOD

    static void HHVM_METHOD(EventHttp, __construct, const Object &base) {
        evhttp_t *http;
        InternalResourceData *event_base_resource_data = FETCH_RESOURCE(base, InternalResourceData, s_event_base);
        event_base_t *event_base = (event_base_t *)event_base_resource_data->getInternalResourceData();
        http = evhttp_new(event_base);

        if(!http){
            raise_error("Failed to allocate space for new HTTP server(evhttp_new)");
        }

        Resource resource = Resource(NEWOBJ(EventHttpResourceData(http)));
        SET_RESOURCE(this_, resource, s_event_http);
    }
开发者ID:RickySu,项目名称:hhvm-ext-event,代码行数:13,代码来源:ext_event_http.cpp

示例7: resources

CCMSDIntegrator::CCMSDIntegrator(void)
:
		resources((std::vector<IObjectPtr>&) Resource().objects()),
		cells((std::vector<IObjectPtr>&) Cell().objects()),
		parts((std::vector<IObjectPtr>&) Part().objects()),
		processplans((std::vector<IObjectPtr>&) ProcessPlan().objects()),
		jobs((std::vector<IObjectPtr>&) Job().objects()),
		distributions((std::vector<IObjectPtr>&) Distribution().objects()),
		calendars((std::vector<IObjectPtr>&) Calendar().objects()),
		layouts((std::vector<IObjectPtr>&) Layout().objects())

{
}
开发者ID:amanrenishaw,项目名称:MTConnectGadgets,代码行数:13,代码来源:ResourceIntegrator.cpp

示例8: invoke

Resource UserFile::invokeCast(int castas) {
  bool invoked = false;
  Variant ret = invoke(
    m_StreamCast,
    s_stream_cast,
    PackedArrayInit(1)
      .append(castas)
      .toArray(),
    invoked
  );

  if (!invoked) {
    raise_warning(
      "%s::stream_cast is not implemented!",
      m_cls->name()->data()
    );
    return Resource();
  }
  if (ret.toBoolean() == false) {
    return Resource();
  }
  auto f = dyn_cast_or_null<File>(ret);
  if (!f) {
    raise_warning(
      "%s::stream_cast must return a stream resource",
      m_cls->name()->data()
    );
    return Resource();
  }
  if (f == this) {
    raise_warning(
      "%s::stream_cast must not return itself",
      m_cls->name()->data()
    );
    return Resource();
  }

  return Resource(std::move(f));
}
开发者ID:HilayPatel,项目名称:hhvm,代码行数:39,代码来源:user-file.cpp

示例9: msg

int
cIpmiControlIntelRmsLed::SetIdentify( unsigned char tval)
{
  cIpmiMsg msg( eIpmiNetfnChassis, eIpmiCmdChassisIdentify );
  msg.m_data[0] = tval; /*num seconds*/
  msg.m_data_len = 1;
  cIpmiMsg rsp;

  SaErrorT rv = Resource()->SendCommandReadLock( this, msg, rsp );
  if (rv != 0) return(rv);
  if (rsp.m_data[0] != 0) rv = rsp.m_data[0];  /*comp code*/
  return(rv);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:13,代码来源:ipmi_mc_vendor_intel.cpp

示例10: f_stream_context_get_default

Variant f_stream_context_get_default(const Array& options /* = null_array */) {
  Resource &resource = g_context->getStreamContext();
  if (resource.isNull()) {
    resource = Resource(NEWOBJ(StreamContext)(Array::Create(),
                                              Array::Create()));
    g_context->setStreamContext(resource);
  }
  StreamContext *context = resource.getTyped<StreamContext>();
  if (!options.isNull() && !f_stream_context_set_option0(context, options)) {
    return false;
  }
  return resource;
}
开发者ID:2bj,项目名称:hhvm,代码行数:13,代码来源:ext_stream.cpp

示例11: lime_font_load

	value lime_font_load (value data) {
		
		#ifdef LIME_FREETYPE
		Resource resource;
		
		if (val_is_string (data)) {
			
			resource = Resource (val_string (data));
			
		} else {
			
			Bytes bytes (data);
			resource = Resource (&bytes);
			
		}
		
		Font *font = new Font (&resource, 0);
		
		if (font) {
			
			if (font->face) {
				
				value v = alloc_float ((intptr_t)font);
				val_gc (v, lime_font_destroy);
				return v;
				
			} else {
				
				delete font;
				
			}
			
		}
		#endif
		
		return alloc_null ();
		
	}
开发者ID:jarnik,项目名称:lime,代码行数:38,代码来源:ExternalInterface.cpp

示例12: TTF_OpenFont

//@TODO wyalic nie uzywana metode
void Resource::loadFonts() {

    //bold small
    {
        TTF_Font* font = TTF_OpenFont(
                             Property::get("FONT_BOLD_PATH").c_str(),
                             Property::getSetting("SMALL_FONT")
                         );

        if ( font == NULL )  Resource().fontError();
        pFonts.insert( std::pair<string,TTF_Font*>( "bold_small",font ));
    }

    //bold normal
    {
        TTF_Font* font = TTF_OpenFont(
                             Property::get("FONT_BOLD_PATH").c_str(),
                             Property::getSetting("NORMAL_FONT")
                         );

        if ( font == NULL )  Resource().fontError();
        pFonts.insert( std::pair<string,TTF_Font*>( "bold",font ));
    }

    //bold big
    {
        TTF_Font* font = TTF_OpenFont(
                             Property::get("FONT_BOLD_PATH").c_str(),
                             Property::getSetting("BIG_FONT")
                         );

        if ( font == NULL )  Resource().fontError();
        pFonts.insert( std::pair<string,TTF_Font*>( "bold_big",font ));
    }

    ///@TODO dodac reszte czcionek

}
开发者ID:lolciuuu,项目名称:astro_rush_0.0.2,代码行数:39,代码来源:Resource.cpp

示例13: DefaultZoom

BoxBrowser::BoxBrowser()
{
	currentSelection = 0;
	busy = false;
	ignoreInput = false;
	needToUpdateBoxes = true;
	showDetails = false;
	width = WINDOW_WIDTH;
	height = WINDOW_HEIGHT;
	mode = M_IDLE;
	speed = 0;
	buttonDelay = 0;
	animFrame = 0;
	inputIdx = 0;
	listIdx = 0;
	viewMode = viewFlow;
	bgImg1 = NULL;
	bgImg2 = NULL;
	//ratingImg = NULL;
	//ratingImgData = NULL;
	camY = 0;
	camdif = 1;
	camDelay = 3;
	DefaultZoom();

	gameText = new GuiText( font, (char*)NULL, 20, 0x00ff00ff );
	gameText->SetAlignment( ALIGN_TOP | ALIGN_CENTER );
	gameText->SetPosition( 0, 40 );
	gameText->SetParent( this );

//	zIdTxt = new GuiText( font, (char*)NULL, 20, 0x00ff00ff );
//	zIdTxt->SetAlignment( ALIGN_TOP | ALIGN_RIGHT );
//	zIdTxt->SetPosition( 0, -40 );
//	zIdTxt->SetParent( this );

	CreateMaxtrices();

	//create nocover data
	noCoverdata = new (std::nothrow) GuiImageData( Resource( "images/nocoverFull.png" ), TINY3D_TEX_FORMAT_R5G6B5 );
	if( !noCoverdata )
	{
		printf("oh snap! failed to create noCoverdata.  this wont end well\n");
		return;
	}
	//create boxes
	for( int i = 0; i < NUM_BOXES; i++ )
	{
		box[ i ] = new BoxCover();
	}
}
开发者ID:giantpune,项目名称:libps3gui,代码行数:50,代码来源:boxbrowser.cpp

示例14: Resource

void Sender::Clear() {
    if (_main_cntl == NULL) {
        return;
    }
    delete _alloc_resources[1].response;
    delete _alloc_resources[1].sub_done;
    _alloc_resources[1] = Resource();
    const CallId cid = _main_cntl->call_id();
    _main_cntl = NULL;
    if (_user_done) {
        _user_done->Run();
    }
    bthread_id_unlock_and_destroy(cid);
}
开发者ID:yzhenma,项目名称:brpc,代码行数:14,代码来源:selective_channel.cpp

示例15: f_mysql_list_tables

Variant f_mysql_list_tables(const String& database,
                            CVarRef link_identifier /* = null */) {
  MYSQL *conn = MySQL::GetConn(link_identifier);
  if (!conn) return false;
  if (mysql_select_db(conn, database.data())) {
    return false;
  }
  MYSQL_RES *res = mysql_list_tables(conn, NULL);
  if (!res) {
    raise_warning("Unable to save MySQL query result");
    return false;
  }
  return Resource(NEWOBJ(MySQLResult)(res));
}
开发者ID:Bluarggag,项目名称:hhvm,代码行数:14,代码来源:ext_mysql.cpp


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