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


C++ SharedPtr类代码示例

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


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

示例1: dispatchDidFirstLayout

void WebFrameLoaderClient::dispatchDidFirstLayout()
{
    SharedPtr<WebFrameLoadDelegate> frameLoadDelegate = m_webFrame->webView()->webFrameLoadDelegate();
    if (frameLoadDelegate)
        frameLoadDelegate->dispatchDidFirstLayout(m_webFrame);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:6,代码来源:WebFrameLoaderClient.cpp

示例2: Load

bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
{
    if (!image)
    {
        LOGERROR("Null image, can not load texture");
        return false;
    }
    
    unsigned memoryUse = 0;
    
    int quality = QUALITY_HIGH;
    Renderer* renderer = GetSubsystem<Renderer>();
    if (renderer)
        quality = renderer->GetTextureQuality();
    
    if (!image->IsCompressed())
    {
        unsigned char* levelData = image->GetData();
        int levelWidth = image->GetWidth();
        int levelHeight = image->GetHeight();
        unsigned components = image->GetComponents();
        unsigned format = 0;
        
        if (levelWidth != levelHeight)
        {
            LOGERROR("Cube texture width not equal to height");
            return false;
        }
        
        // Discard unnecessary mip levels
        for (unsigned i = 0; i < mipsToSkip_[quality]; ++i)
        {
            image = image->GetNextLevel();
            levelData = image->GetData();
            levelWidth = image->GetWidth();
            levelHeight = image->GetHeight();
        }
        
        switch (components)
        {
        case 1:
            format = useAlpha ? Graphics::GetAlphaFormat() : Graphics::GetLuminanceFormat();
            break;
            
        case 2:
            format = Graphics::GetLuminanceAlphaFormat();
            break;
            
        case 3:
            format = Graphics::GetRGBFormat();
            break;
            
        case 4:
            format = Graphics::GetRGBAFormat();
            break;
        }
        
        // Create the texture when face 0 is being loaded, check that rest of the faces are same size & format
        if (!face)
        {
            // If image was previously compressed, reset number of requested levels to avoid error if level count is too high for new size
            if (IsCompressed() && requestedLevels_ > 1)
                requestedLevels_ = 0;
            SetSize(levelWidth, format);
        }
        else
        {
            if (!object_)
            {
                LOGERROR("Cube texture face 0 must be loaded first");
                return false;
            }
            if (levelWidth != width_ || format != format_)
            {
                LOGERROR("Cube texture face does not match size or format of face 0");
                return false;
            }
        }
        
        for (unsigned i = 0; i < levels_; ++i)
        {
            SetData(face, i, 0, 0, levelWidth, levelHeight, levelData);
            memoryUse += levelWidth * levelHeight * components;
            
            if (i < levels_ - 1)
            {
                image = image->GetNextLevel();
                levelData = image->GetData();
                levelWidth = image->GetWidth();
                levelHeight = image->GetHeight();
            }
        }
    }
    else
    {
        int width = image->GetWidth();
        int height = image->GetHeight();
        unsigned levels = image->GetNumCompressedLevels();
        unsigned format = graphics_->GetFormat(image->GetCompressedFormat());
        bool needDecompress = false;
//.........这里部分代码省略.........
开发者ID:codeman001,项目名称:Urho3D,代码行数:101,代码来源:D3D9TextureCube.cpp

示例3: buildSimpleMechanicExample

Node* buildSimpleMechanicExample()
{
  SharedPtr<Group> group = new Group("G");

  MobileRootJoint* mobileRootJoint = new MobileRootJoint("Root Joint");
  group->addChild(mobileRootJoint);

  RigidBody *rigidBody = new RigidBody("Rigid Body");
  rigidBody->addLink("link2");
  rigidBody->addLink("externalInteractLink");
  rigidBody->addLink("internalInteractLink");
  rigidBody->addLink("internalInteractLink2");
  group->addChild(rigidBody);
  InertiaMatrix inertia(1, 0, 0, 1, 0, 1);
  Mass* mass = new Mass("Mass", 1, inertia);
  group->addChild(mass);
  RevoluteJoint* revoluteJoint = new RevoluteJoint("Revolute Joint");
  revoluteJoint->setEnableExternalForce(true);
  group->addChild(revoluteJoint);
  RigidBody *rigidBody2 = new RigidBody("Rigid Body 2");
  rigidBody2->addLink("externalInteractLink");
  rigidBody2->addLink("internalInteractLink");
  rigidBody2->addLink("internalInteractLink2");
  group->addChild(rigidBody2);
  Mass* mass2 = new Mass("Mass 2", 1, inertia);
  group->addChild(mass2);

  ExternalInteract* externalInteract = new ExternalInteract("ExternalInteract");
  externalInteract->setPosition(mass->getPosition());
  externalInteract->setEnableAllOutputs(true);
  group->addChild(externalInteract);

  ExternalInteract* externalInteract2 = new ExternalInteract("ExternalInteract 2");
  externalInteract2->setPosition(mass2->getPosition());
  externalInteract2->setEnableAllOutputs(true);
  group->addChild(externalInteract2);

  group->connect(mobileRootJoint->getPort("link"), rigidBody->getPort("link0"));
  group->connect(rigidBody->getPort("link1"), mass->getPort("link"));
  group->connect(rigidBody->getPort("link2"), revoluteJoint->getPort("link0"));
  group->connect(revoluteJoint->getPort("link1"), rigidBody2->getPort("link0"));
  group->connect(rigidBody2->getPort("link1"), mass2->getPort("link"));
  group->connect(rigidBody->getPort("externalInteractLink"), externalInteract->getPort("link"));
  group->connect(rigidBody2->getPort("externalInteractLink"), externalInteract2->getPort("link"));

  ConstModel* jointForce = new ConstModel("Joint Force", 1);
  group->addChild(jointForce);

  group->connect(jointForce->getPort("output"),
                 revoluteJoint->getPort("force"));

  InternalInteract* internalInteract = new InternalInteract("InternalInteract");
  internalInteract->setPosition0(Vector3(0, 0, 1));
  internalInteract->setPosition1(Vector3(0, 0, 0.8));
  internalInteract->setEnableAllOutputs(true);
  internalInteract->setEnableForce(true);
  group->addChild(internalInteract);
  group->connect(internalInteract->getPort("link0"),
                 rigidBody->getPort("internalInteractLink"));
  group->connect(internalInteract->getPort("link1"),
                 rigidBody2->getPort("internalInteractLink"));


  InternalInteract* internalInteract2 = new InternalInteract("InternalInteract2");
  internalInteract2->setPosition0(Vector3(0, 0, 0.8));
  internalInteract2->setPosition1(Vector3(0, 0, 1));
  internalInteract2->setEnableAllOutputs(true);
  group->addChild(internalInteract2);
  group->connect(internalInteract2->getPort("link1"),
                 rigidBody->getPort("internalInteractLink2"));
  group->connect(internalInteract2->getPort("link0"),
                 rigidBody2->getPort("internalInteractLink2"));

  LinearSpringDamper* damper = new LinearSpringDamper("LinearSpringDamper");
  damper->setSpringConstant(0.5);
  damper->setDamperConstant(1);
  group->addChild(damper);
  group->connect(damper->getPort("velocity"),
                 internalInteract->getPort("velocity"));
  group->connect(damper->getPort("position"),
                 internalInteract->getPort("distance"));
  group->connect(damper->getPort("force"),
                 internalInteract->getPort("force"));

  return group.release();
}
开发者ID:BackupTheBerlios,项目名称:openfdm-svn,代码行数:86,代码来源:mechanic.cpp

示例4: while

bool Shader::ProcessSource(SharedArrayPtr<char>& dest, unsigned& length, const String& fileName)
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    if (!cache)
        return false;
    
    // Allow to define only a vertex shader or only a pixel shader
    if (!cache->Exists(fileName))
        return true;
    
    cache->StoreResourceDependency(this, fileName);
    
    Vector<String> glslCode;
    
    // Load the shader source code
    SharedPtr<File> glslFile = cache->GetFile(fileName);
    if (!glslFile)
        return false;
    
    while (!glslFile->IsEof())
        glslCode.Push(glslFile->ReadLine());
    
    // Process the code for includes
    for (unsigned i = 0; i < glslCode.Size(); ++i)
    {
        if (glslCode[i].StartsWith("#include"))
        {
            String includeFileName = GetPath(fileName) + glslCode[i].Substring(9).Replaced("\"", "").Trimmed();
            
            SharedPtr<File> glslIncludeFile = cache->GetFile(includeFileName);
            if (!glslIncludeFile)
                return false;
            
            // Remove the #include line, then include the code
            glslCode.Erase(i);
            unsigned pos = i;
            while (!glslIncludeFile->IsEof())
            {
                glslCode.Insert(pos, glslIncludeFile->ReadLine());
                ++pos;
            }
            // Finally insert an empty line to mark the space between files
            glslCode.Insert(pos, "");
        }
    }
    
    // Copy the final code into one memory block
    length = 0;
    for (unsigned i = 0; i < glslCode.Size(); ++i)
        length += glslCode[i].Length() + 1;
    
    dest = new char[length];
    char* destPtr = dest.Get();
    for (unsigned i = 0; i < glslCode.Size(); ++i)
    {
        memcpy(destPtr, glslCode[i].CString(), glslCode[i].Length());
        destPtr += glslCode[i].Length();
        *destPtr++ = '\n';
    }
    
    return true;
}
开发者ID:jjiezheng,项目名称:urho3d,代码行数:62,代码来源:OGLShader.cpp

示例5: Stop

void NetworkModule::Stop ()
{
    SharedPtr<NetworkBinding> b = this->variables.cast<NetworkBinding>();
    b->Shutdown();
}
开发者ID:vladtepesdrakul,项目名称:titanium,代码行数:5,代码来源:network_module.cpp

示例6: bar

void bar(SharedPtr<Foo> ptr)
{
    int i = ptr->Get();
    assert(i == 1);
}
开发者ID:bjlovegithub,项目名称:CLPIM,代码行数:5,代码来源:shared_ptr_test.cpp

示例7: HandleNodeCollisionStart

void TerrySpawner::HandleNodeCollisionStart(StringHash eventType, VariantMap& eventData)
{
	using namespace NodeCollisionStart;

	SharedPtr<Node> otherNode = SharedPtr<Node>(static_cast<Node*>(eventData[P_OTHERNODE].GetPtr()));
	RigidBody* rb = static_cast<RigidBody*>(eventData[P_BODY].GetPtr());

	Node* noed = rb->GetNode();

	if (otherNode->GetName() == "safetyNet")
	{
		RespawnTerry(noed);
		return;
	}

	if (!otherNode->HasComponent<Health>())
	{
		return;
	}

	if (otherNode->GetVar("npcType").GetInt() == 0)//hero
	{
		MoveByTouch* mbt = noed->GetComponent<MoveByTouch>();
		mbt->MoveTo(otherNode->GetWorldPosition(),
				mbt->moveToSpeed_,mbt->speedRamp_,mbt->gravity_,mbt->gravityRamp_,false,true,true);

		int collisionCount = noed->GetVar("collisionCount").GetInt();
		collisionCount++;
		noed->SetVar("collisionCount", collisionCount);

		if (collisionCount == 1)
		{
			VariantMap vm;
			vm[AnimateSceneNode::P_NODE] = noed;

			if (noed->GetVar("sex").GetBool())
			{
				vm[AnimateSceneNode::P_ANIMATION] = "attackF";
			}
			else
			{
				vm[AnimateSceneNode::P_ANIMATION] = "attackM";
			}

			vm[AnimateSceneNode::P_LOOP] = false;
			vm[AnimateSceneNode::P_LAYER] = 0;
			SendEvent(E_ANIMATESCENENODE, vm);
		}

		if (noed->GetComponent<Blind>() || noed->GetComponent<Stunned>())
		{
			return;
		}

		int healthMod = noed->GetVar("attack").GetInt();

		if (otherNode->HasComponent<Armor>())
		{
			healthMod = noed->GetVar("attack").GetInt() - otherNode->GetComponent<Armor>()->armor_;

			if (healthMod < 0)
			{
				healthMod = 0;
			}
		}

		otherNode->GetComponent<Health>()->ModifyHealth(healthMod, -1, false);

		if (otherNode->GetComponent<Health>()->health_ <= 0)
		{
			if (otherNode->GetName() != "tent")
			{
				if (!otherNode->HasComponent<Dead>())
				{
					otherNode->AddComponent(new Dead(context_, main_, -1.0f), 0, LOCAL);
				}
			}
			else
			{
				SpriteSheetPlayer* ssp = main_->mySceneNode_->GetComponent<SpriteSheetPlayer>();
				for (int x = 0; x < ssp->sprites_.Size(); x++)
				{
					if (!ssp->sprites_[x]->noed_->HasComponent<Dead>())
					{
						ssp->sprites_[x]->noed_->AddComponent(new Dead(context_, main_, -1.0f), 0, LOCAL);

						Node* particleStartNode_ = ssp->sprites_[x]->noed_->GetScene()->CreateChild(0,LOCAL);
						particleStartNode_->SetPosition(ssp->sprites_[x]->noed_->GetPosition());

						particleStartNode_->AddComponent(new TimedRemove(context_, main_, 2.0f), 0, LOCAL);

						particleStartNode_->AddComponent(new SoundSource3D(context_), 0, LOCAL);
						particleStartNode_->GetComponent<SoundSource3D>()->SetGain(0.1f);
						particleStartNode_->GetComponent<SoundSource3D>()->Play(main_->cache_->GetResource<Sound>("Sounds/319071__mishicu__v8.ogg"));

					}
				}
			}

			//otherNode->GetComponent<Health>()->ModifyHealth(100, 0, false);
//.........这里部分代码省略.........
开发者ID:practicing01,项目名称:Terries,代码行数:101,代码来源:TerrySpawner.cpp

示例8: HandleNodeCollision

void TerrySpawner::HandleNodeCollision(StringHash eventType, VariantMap& eventData)
{
	using namespace NodeCollision;

	RigidBody* rb = static_cast<RigidBody*>(eventData[P_BODY].GetPtr());

	Node* noed = rb->GetNode();

	if (!noed->GetVar("canAttack").GetBool())
	{
		return;
	}

	if (noed->GetComponent<Blind>())
	{
		return;
	}

	noed->SetVar("canAttack", false);

	SharedPtr<Node> otherNode = SharedPtr<Node>(static_cast<Node*>(eventData[P_OTHERNODE].GetPtr()));

	if (!otherNode->HasComponent<Health>())
	{
		return;
	}

	bool enemy = false;

	if (otherNode->GetVar("npcType").GetInt() == 0)//hero
	{
		enemy = true;
	}

	if (enemy || noed->HasComponent<Enchanted>())
	{
		int healthMod = noed->GetVar("attack").GetInt();

		if (otherNode->HasComponent<Armor>())
		{
			healthMod = noed->GetVar("attack").GetInt() - otherNode->GetComponent<Armor>()->armor_;

			if (healthMod < 0)
			{
				healthMod = 0;
			}
		}

		otherNode->GetComponent<Health>()->ModifyHealth(healthMod, -1, false);

		if (otherNode->GetComponent<Health>()->health_ <= 0)
		{
			if (!enemy && noed->HasComponent<Enchanted>())
			{
				otherNode->GetComponent<Health>()->ModifyHealth(100, 0, false);
				otherNode->GetScene()->GetComponent<TerrySpawner>()->RespawnTerry(otherNode);
			}
			else if (otherNode->GetName() != "tent")
			{
				if (!otherNode->HasComponent<Dead>())
				{
					otherNode->AddComponent(new Dead(context_, main_, -1.0f), 0, LOCAL);
				}
			}
			else
			{
				SpriteSheetPlayer* ssp = main_->mySceneNode_->GetComponent<SpriteSheetPlayer>();
				for (int x = 0; x < ssp->sprites_.Size(); x++)
				{
					if (!ssp->sprites_[x]->noed_->HasComponent<Dead>())
					{
						ssp->sprites_[x]->noed_->AddComponent(new Dead(context_, main_, -1.0f), 0, LOCAL);

						Node* particleStartNode_ = ssp->sprites_[x]->noed_->GetScene()->CreateChild(0,LOCAL);
						particleStartNode_->SetPosition(ssp->sprites_[x]->noed_->GetPosition());

						particleStartNode_->AddComponent(new TimedRemove(context_, main_, 2.0f), 0, LOCAL);

						particleStartNode_->AddComponent(new SoundSource3D(context_), 0, LOCAL);
						particleStartNode_->GetComponent<SoundSource3D>()->SetGain(0.1f);
						particleStartNode_->GetComponent<SoundSource3D>()->Play(main_->cache_->GetResource<Sound>("Sounds/319071__mishicu__v8.ogg"));

					}
				}
			}

			return;
		}

		/*if (!noed->HasComponent<Stunned>())
		{
			noed->AddComponent(new Stunned(context_, main_, 2.0f), 0, LOCAL);
		}*/
	}
}
开发者ID:practicing01,项目名称:Terries,代码行数:95,代码来源:TerrySpawner.cpp

示例9: main

//
// main
//
int main(int argc, char **argv) {
#ifdef __unix__
   // Load wxWindows Stub (for pop-up dialogues)
   (void)dlopen(WXSTUB_DLL_NAME, RTLD_NOW|RTLD_NODELETE);
#endif

#ifdef LOG
   char buff[1000];
   if (getUserDataDir(buff, sizeof(buff)) != 0) {
      strcpy(buff, "c:");
   }
   strcat(buff, "/gdbServer.log");
   FILE *errorLog = fopen(buff, "wt");
   Logging::setLogFileHandle(errorLog);
#endif
   Logging::setLoggingLevel(100);
   LOGGING;

#ifdef LOG
   Logging::print("Args = ");
   for (int index=0; index<argc; index++) {
      Logging::printq("%s ", argv[index]);
   }
   Logging::printq("\n");
#endif
   if (signal(SIGINT, signalHandler) == SIG_IGN) {
      (void)signal(SIGINT, SIG_IGN);
   }

   shared = SharedPtr(new Shared(TARGET_TYPE));

   USBDM_ErrorCode rc = doArgs(argc, argv);
   if (rc != BDM_RC_OK) {
      Logging::print("Error %s\n", USBDM_GetErrorString(rc));
      exit (-1);
   }
   Logging::print("After doArgs\n");

   rc = shared->initBdm();
   if (rc != BDM_RC_OK) {
      Logging::print("Error %s\n", USBDM_GetErrorString(rc));
      exit (-1);
   }
   Logging::print("After shared->initBdm()\n");
   //   setDefaultWindowParent(FindEclipseWindowHwnd());

   GdbInOutPipe  *gdbInOut  = GdbInOutPipe::getGdbInOut();
   Logging::print("After GdbInOutPipe::getGdbInOut()\n");

   // Redirect stdout to stderr
   dup2(2,1);

   if (gdbInOut == NULL) {
      Logging::print("Error gdbInOut() creation failed\n");
      exit (-1);
   }
   Logging::print("After gdbInOut()\n");

   // Now do the actual processing of GDB messages
   gdbHandlerInit(gdbInOut, *shared->getCurrentDevice(), callBack);
   gdbLoop(gdbInOut);

   gdbInOut->finish();
   delete gdbInOut;

   return 0;
}
开发者ID:Gibbon1,项目名称:usbdm-eclipse-makefiles-build,代码行数:70,代码来源:GdbPipeServer.cpp

示例10: PROFILE

bool Texture3D::Load(Deserializer& source)
{
    PROFILE(LoadTexture3D);
    
    // In headless mode, do not actually load the texture, just return success
    if (!graphics_)
        return true;
    
    // If device is lost, retry later
    if (graphics_->IsDeviceLost())
    {
        LOGWARNING("Texture load while device is lost");
        dataPending_ = true;
        return true;
    }
    
    // If over the texture budget, see if materials can be freed to allow textures to be freed
    CheckTextureBudget(GetTypeStatic());

    // Before actually loading the texture, get optional parameters from an XML description file
    LoadParameters();

    String texPath, texName, texExt;
    SplitPath(GetName(), texPath, texName, texExt);
    
    SharedPtr<XMLFile> xml(new XMLFile(context_));
    if (!xml->Load(source))
        return false;

    XMLElement textureElem = xml->GetRoot();
    XMLElement volumeElem = textureElem.GetChild("volume");
    XMLElement colorlutElem = textureElem.GetChild("colorlut");

    if (volumeElem)
    {
        String name = volumeElem.GetAttribute("name");
        
        String volumeTexPath, volumeTexName, volumeTexExt;
        SplitPath(name, volumeTexPath, volumeTexName, volumeTexExt);
        // If path is empty, add the XML file path
        if (volumeTexPath.Empty())
            name = texPath + name;

        SharedPtr<Image> image(GetSubsystem<ResourceCache>()->GetResource<Image>(name));
        return Load(image);
    }
    else if (colorlutElem)
    {
        String name = colorlutElem.GetAttribute("name");
        
        String colorlutTexPath, colorlutTexName, colorlutTexExt;
        SplitPath(name, colorlutTexPath, colorlutTexName, colorlutTexExt);
        // If path is empty, add the XML file path
        if (colorlutTexPath.Empty())
            name = texPath + name;

        SharedPtr<File> file = GetSubsystem<ResourceCache>()->GetFile(name);
        SharedPtr<Image> image(new Image(context_));
        if (!image->LoadColorLUT(*(file.Get())))
            return false;

        return Load(image);
    }

    return false;
}
开发者ID:codeman001,项目名称:Urho3D,代码行数:66,代码来源:OGLTexture3D.cpp

示例11: AttachLogicComponents

void DotsNetCrits::AttachLogicComponents(SharedPtr<Node> sceneNode)
{
	sceneNode->AddComponent(new ModelPlayer(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new TopDownCamera(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new ThirdPersonCamera(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Speed(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Gravity(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new MoveByTouch(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new RotateTo(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Silence(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Teleport(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Sprint(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Snare(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Blind(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Melee(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Health(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Mute(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Armor(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Shield(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new DPSHeal(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new BlindingFlash(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Crit(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new DOT(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new DOTHeal(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new AOE(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new AOEHeal(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Cloak(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Cleanse(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new Knockback(context_, main_), 0, LOCAL);

	sceneNode->AddComponent(new SoundPlayer(context_, main_), 0, LOCAL);
}
开发者ID:nonconforme,项目名称:Urho3DTemplate,代码行数:58,代码来源:DotsNetCrits.cpp

示例12: OS

void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
{
#if OS(AMIGAOS4)
    if (!m_webFrame->parentFrame()) {
        BalWidget* viewWindow = m_webFrame->webView()->viewWindow();
        if (viewWindow && viewWindow->window) {
            extern char* utf8ToAmiga(const char* utf8);

            char *titlestr = utf8ToAmiga(title.utf8().data());
            if (titlestr && titlestr[0])
                snprintf(viewWindow->title, sizeof(viewWindow->title), viewWindow->clickTabNode ? "%s" : "OWB: %s", titlestr);
            else
                strcpy(viewWindow->title, "Origyn Web Browser");
            free(titlestr);

            if (amigaConfig.tabs) {
                IIntuition->SetGadgetAttrs(viewWindow->gad_clicktab, viewWindow->window, NULL,
                                           CLICKTAB_Labels, ~0,
                                           TAG_DONE);

                IClickTab->SetClickTabNodeAttrs(viewWindow->clickTabNode, TNA_Text, viewWindow->title, TAG_DONE);

                IIntuition->RefreshSetGadgetAttrs(viewWindow->gad_clicktab, viewWindow->window, NULL,
                                                  CLICKTAB_Labels, viewWindow->clickTabList,
                                                  TAG_DONE);
            }
            else
                IIntuition->SetWindowTitles(viewWindow->window, viewWindow->title, (STRPTR)~0UL);

            CString urlLatin1 = url.prettyURL().latin1();
            const char *urlstr = urlLatin1.data();
            if (urlstr && urlstr[0] && viewWindow->gad_url) {
                snprintf(viewWindow->url, sizeof(viewWindow->url), "%s", urlstr);
                if (ILayout->SetPageGadgetAttrs(viewWindow->gad_url, viewWindow->page,
                                                viewWindow->window, NULL,
                                                STRINGA_TextVal, viewWindow->url,
                                                TAG_DONE))
                    ILayout->RefreshPageGadget(viewWindow->gad_url, viewWindow->page, viewWindow->window, NULL);
            }
        }
    }
#endif
    WebView* webView = m_webFrame->webView();
    SharedPtr<WebHistoryDelegate> historyDelegate = webView->historyDelegate();
    if (historyDelegate) {
        historyDelegate->updateHistoryTitle(webView, title.utf8().data(), url.string().utf8().data());
        return;
    }
    bool privateBrowsingEnabled = false;
    WebPreferences* preferences = m_webFrame->webView()->preferences();
    if (preferences)
        privateBrowsingEnabled = preferences->privateBrowsingEnabled();
    if (privateBrowsingEnabled)
        return;

    // update title in global history
    WebHistory* history = webHistory();
    if (!history)
        return;

    WebHistoryItem* item = history->itemForURL(strdup(url.string().utf8().data()));
    if (!item)
        return;

    item->setTitle(title.utf8().data());
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:66,代码来源:WebFrameLoaderClient.cpp

示例13: postProgressEstimateChangedNotification

void WebFrameLoaderClient::postProgressEstimateChangedNotification()
{
    SharedPtr<WebNotificationDelegate> webNotificationDelegate = m_webFrame->webView()->webNotificationDelegate();
    if (webNotificationDelegate)
        webNotificationDelegate->progressNotification(m_webFrame);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:6,代码来源:WebFrameLoaderClient.cpp

示例14: clone

void AnimatedModel::CloneGeometries()
{
    const Vector<SharedPtr<VertexBuffer> >& originalVertexBuffers = model_->GetVertexBuffers();
    HashMap<VertexBuffer*, SharedPtr<VertexBuffer> > clonedVertexBuffers;
    morphVertexBuffers_.Resize(originalVertexBuffers.Size());

    for (unsigned i = 0; i < originalVertexBuffers.Size(); ++i)
    {
        VertexBuffer* original = originalVertexBuffers[i];
        if (model_->GetMorphRangeCount(i))
        {
            SharedPtr<VertexBuffer> clone(new VertexBuffer(context_));
            clone->SetShadowed(true);
            clone->SetSize(original->GetVertexCount(), morphElementMask_ & original->GetElementMask(), true);
            void* dest = clone->Lock(0, original->GetVertexCount());
            if (dest)
            {
                CopyMorphVertices(dest, original->GetShadowData(), original->GetVertexCount(), clone, original);
                clone->Unlock();
            }
            clonedVertexBuffers[original] = clone;
            morphVertexBuffers_[i] = clone;
        }
        else
            morphVertexBuffers_[i].Reset();
    }

    // Geometries will always be cloned fully. They contain only references to buffer, so they are relatively light
    for (unsigned i = 0; i < geometries_.Size(); ++i)
    {
        for (unsigned j = 0; j < geometries_[i].Size(); ++j)
        {
            SharedPtr<Geometry> original = geometries_[i][j];
            SharedPtr<Geometry> clone(new Geometry(context_));

            // Add an additional vertex stream into the clone, which supplies only the morphable vertex data, while the static
            // data comes from the original vertex buffer(s)
            const Vector<SharedPtr<VertexBuffer> >& originalBuffers = original->GetVertexBuffers();
            unsigned totalBuf = originalBuffers.Size();
            for (unsigned k = 0; k < originalBuffers.Size(); ++k)
            {
                VertexBuffer* originalBuffer = originalBuffers[k];
                if (clonedVertexBuffers.Contains(originalBuffer))
                    ++totalBuf;
            }
            clone->SetNumVertexBuffers(totalBuf);

            unsigned l = 0;
            for (unsigned k = 0; k < originalBuffers.Size(); ++k)
            {
                VertexBuffer* originalBuffer = originalBuffers[k];

                if (clonedVertexBuffers.Contains(originalBuffer))
                {
                    VertexBuffer* clonedBuffer = clonedVertexBuffers[originalBuffer];
                    clone->SetVertexBuffer(l++, originalBuffer);
                    // Specify the morph buffer at a greater index to override the model's original positions/normals/tangents
                    clone->SetVertexBuffer(l++, clonedBuffer);
                }
                else
                    clone->SetVertexBuffer(l++, originalBuffer);
            }

            clone->SetIndexBuffer(original->GetIndexBuffer());
            clone->SetDrawRange(original->GetPrimitiveType(), original->GetIndexStart(), original->GetIndexCount());
            clone->SetLodDistance(original->GetLodDistance());

            geometries_[i][j] = clone;
        }
    }

    // Make sure the rendering batches use the new cloned geometries
    ResetLodLevels();
    MarkMorphsDirty();
}
开发者ID:iSLC,项目名称:Urho3D,代码行数:75,代码来源:AnimatedModel.cpp

示例15: WriteLine

	void FileStream::WriteLine(const ValueList& args, SharedValue result)
	{
		if(! this->stream)
		{
			throw ValueException::FromString("FileStream must be opened before calling readLine");
		}
		char *text = NULL;
		int size = 0;
		if (args.at(0)->IsObject())
		{
			SharedKObject b = args.at(0)->ToObject();
			SharedPtr<Blob> blob = b.cast<Blob>();
			if (!blob.isNull())
			{
				text = (char*)blob->Get();
				size = (int)blob->Length();
			}
		}
		else if (args.at(0)->IsString())
		{
			text = (char*)args.at(0)->ToString();
		}
		else if (args.at(0)->IsInt())
		{
			std::stringstream ostr;
			ostr << args.at(0)->ToInt();
			text = (char*)ostr.str().c_str();
			size = ostr.str().length();
		}
		else if (args.at(0)->IsDouble())
		{
			std::stringstream ostr;
			ostr << args.at(0)->ToDouble();
			text = (char*)ostr.str().c_str();
			size = ostr.str().length();
		}

		if (size==0)
		{
			size = strlen(text);
		}

		if (text == NULL)
		{
			result->SetBool(false);
			return;
		}
		if (size <= 0)
		{
			result->SetBool(false);
			return;
		}
		std::string astr = text;
#ifdef OS_WIN32
		astr += "\r\n";
#else
		astr += "\n";
#endif
		Write((char*)astr.c_str(),astr.length());
		result->SetBool(true);
	}
开发者ID:cfs051059,项目名称:titanium,代码行数:61,代码来源:file_stream.cpp


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