• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CS_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CS_ASSERT

        //-------------------------------------------------------------
		//-------------------------------------------------------------
		void Entity::AddComponent(const ComponentSPtr& in_component)
		{
            CS_ASSERT(in_component != nullptr, "Cannot add null component");
            CS_ASSERT(in_component->GetEntity() == nullptr, "Component cannot be attached to more than 1 entity at a time.");
            
            m_components.push_back(in_component);
            
            in_component->SetEntity(this);
            
            in_component->OnAddedToEntity();
            
            if(GetScene() != nullptr)
            {
                in_component->OnAddedToScene();
                if (m_appActive == true)
                {
                    in_component->OnResume();
                    if (m_appForegrounded == true)
                    {
                        in_component->OnForeground();
                    }
                }
            }
		}
开发者ID:mclaughlinhugh4,项目名称:ChilliSource,代码行数:26,代码来源:Entity.cpp


示例2: CS_ASSERT

 //------------------------------------------------------------------------------
 void GLMesh::BuildMesh(const u8* vertexData, u32 vertexDataSize, const u8* indexData, u32 indexDataSize) noexcept
 {
     CS_ASSERT(vertexDataSize > 0 && vertexData, "Cannot build mesh with empty data");
     
     glGenBuffers(1, &m_vertexBufferHandle);
     CS_ASSERT(m_vertexBufferHandle != 0, "Invalid vertex buffer.");
     
     if(indexData)
     {
         glGenBuffers(1, &m_indexBufferHandle);
         CS_ASSERT(m_indexBufferHandle != 0, "Invalid index buffer.");
     }
     
     glBindBuffer(GL_ARRAY_BUFFER, m_vertexBufferHandle);
     glBufferData(GL_ARRAY_BUFFER, vertexDataSize, vertexData, GL_STATIC_DRAW);
     
     if(indexData)
     {
         glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferHandle);
         glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexDataSize, indexData, GL_STATIC_DRAW);
     }
     
     CS_ASSERT_NOGLERROR("An OpenGL error occurred while creating GLMesh.");
 }
开发者ID:AzCopey,项目名称:ChilliSource,代码行数:25,代码来源:GLMesh.cpp


示例3: CS_ASSERT

 //----------------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------------
 void StandardDrawable::Draw(Rendering::CanvasRenderer* in_renderer, const Core::Matrix3& in_transform, const Core::Vector2& in_absSize, const Core::Colour& in_absColour)
 {
     CS_ASSERT(m_texture != nullptr, "StandardDrawable cannot draw without texture");
     
     //When textures are packed into an atlas their alpha space is cropped. This functionality restores the alpha space by resizing and offsetting the box.
     Core::Vector2 offsetTL
     (
         (-m_atlasFrame.m_originalSize.x * 0.5f) + (m_atlasFrame.m_croppedSize.x * 0.5f) + m_atlasFrame.m_offset.x,
         (m_atlasFrame.m_originalSize.y * 0.5f) - (m_atlasFrame.m_croppedSize.y * 0.5f) - m_atlasFrame.m_offset.y
     );
     offsetTL = in_absSize/m_atlasFrame.m_originalSize * offsetTL;
     Core::Vector2 size = in_absSize/m_atlasFrame.m_originalSize * m_atlasFrame.m_croppedSize;
     
     in_renderer->DrawBox(in_transform, size, offsetTL, m_texture, m_atlasFrame.m_uvs, in_absColour * m_colour, Rendering::AlignmentAnchor::k_middleCentre);
 }
开发者ID:DNSMorgan,项目名称:ChilliSource,代码行数:17,代码来源:StandardDrawable.cpp


示例4: SndSysBasicStream

SndSysSpeexSoundStream::SndSysSpeexSoundStream (csRef<SndSysSpeexSoundData> pData, 
                                                csSndSysSoundFormat *pRenderFormat, 
                                                int Mode3D) : 
SndSysBasicStream(pRenderFormat, Mode3D), m_pSoundData(pData), header(0)
{
  // Allocate an advance buffer
  m_pCyclicBuffer = new SoundCyclicBuffer (
    (m_RenderFormat.Bits/8 * m_RenderFormat.Channels) * 
      (m_RenderFormat.Freq * SPEEX_BUFFER_LENGTH_MULTIPLIER / 
	SPEEX_BUFFER_LENGTH_DIVISOR));
  CS_ASSERT(m_pCyclicBuffer!=0);

  // Initialize speex stream.
  ResetPosition(false);
}
开发者ID:garinh,项目名称:cs,代码行数:15,代码来源:speexstream.cpp


示例5: CS_ASSERT

csStringBase &csStringBase::Overwrite (size_t iPos, const csStringBase &iStr)
{
  CS_ASSERT (iPos <= Size);

  if (GetData() == 0 || iPos == Size)
    return Append (iStr);

  size_t const sl = iStr.Length ();
  size_t const NewSize = iPos + sl;
  ExpandIfNeeded (NewSize);
  char* p = GetDataMutable();                 // GLOBAL NOTE *2*
  memcpy (p + iPos, iStr.GetData (), sl + 1); // GLOBAL NOTE *1*
  Size = NewSize;
  return *this;
}
开发者ID:garinh,项目名称:cs,代码行数:15,代码来源:csstring.cpp


示例6: m_desc

 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 Test::Test(const TestDesc& in_desc, const PassDelegate& in_passDelegate, const FailDelegate& in_failDelegate) noexcept
     : m_desc(in_desc), m_passDelegate(in_passDelegate), m_failDelegate(in_failDelegate)
 {
     CS_ASSERT(m_passDelegate, "A valid pass delegate must be supplied.");
     CS_ASSERT(m_failDelegate, "A valid fail delegate must be supplied.");
     
     m_taskScheduler = CS::Application::Get()->GetTaskScheduler();
     
     m_timerEventConnection = m_timer.OpenConnection(in_desc.GetTimeoutSeconds(), [=]()
     {
         std::unique_lock<std::mutex> lock(m_mutex);
         
         if (m_active)
         {
             m_active = false;
             m_timer.Stop();
             m_timerEventConnection.reset();
             
             m_failDelegate("Timed out.");
         }
     });
     
     m_timer.Start();
 }
开发者ID:ChilliWorks,项目名称:CSTest,代码行数:26,代码来源:Test.cpp


示例7: CS_ASSERT

 //------------------------------------------------------------------------------
 bool BinaryInputStream::Read(u8* buffer, u64 length) noexcept
 {
     CS_ASSERT(IsValid(), "Trying to use an invalid FileStream.");
     
     if(m_fileStream.eof())
     {
         return false;
     }
     
     //Ensure that we never overrun the file stream
     const auto currentPosition = GetReadPosition();
     const auto maxValidLength = std::min(m_length - currentPosition, length);
     
     if(maxValidLength == 0)
     {
         return true;
     }
     
     m_fileStream.read(reinterpret_cast<s8*>(buffer), maxValidLength);
     
     CS_ASSERT(!m_fileStream.fail(), "Unexpected error occured in filestream");
     
     return true;
 }
开发者ID:AzCopey,项目名称:ChilliSource,代码行数:25,代码来源:BinaryInputStream.cpp


示例8: ExpandIfNeeded

csStringBase &csStringBase::PadLeft (size_t iNewSize, char iChar)
{
  if (iNewSize > Size)
  {
    ExpandIfNeeded (iNewSize);
    char* p = GetDataMutable();          // GLOBAL NOTE *2*
    CS_ASSERT(p != 0);
    const size_t toInsert = iNewSize - Size;
    memmove (p + toInsert, p, Size + 1); // GLOBAL NOTE *1*
    for (size_t x = 0; x < toInsert; x++)
      p [x] = iChar;
    Size = iNewSize;
  }
  return *this;
}
开发者ID:garinh,项目名称:cs,代码行数:15,代码来源:csstring.cpp


示例9: CS_ASSERT

 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 EntityUPtr PrimitiveEntityFactory::CreateBox(const Colour& in_colour, const Vector3& in_size)
 {
     CS_ASSERT(Application::Get()->GetTaskScheduler()->IsMainThread(), "Entities must be created on the main thread.");
     
     ModelCSPtr mesh = m_primitiveModelFactory->CreateBox(in_size);
     MaterialCSPtr material = CreateStaticBlinnColourMaterial(in_colour);
     
     StaticModelComponentSPtr meshComponent = m_renderComponentFactory->CreateStaticModelComponent(mesh, material);
     meshComponent->SetShadowCastingEnabled(true);
     
     auto entity = Entity::Create();
     entity->SetName(ToString(m_entityCount++) + "-Box");
     entity->AddComponent(meshComponent);
     return entity;
 }
开发者ID:AzCopey,项目名称:ChilliSource,代码行数:17,代码来源:PrimitiveEntityFactory.cpp


示例10: CS_ASSERT

//-------------------------------------------------------------
//-------------------------------------------------------------
void Entity::RemoveEntity(Entity* in_child)
{
    CS_ASSERT(in_child != nullptr, "Cannot remove null child");
    CS_ASSERT(in_child->GetParent() == this, "Cannot remove entity that is not a child of this");

    SharedEntityList::iterator it = std::find_if(m_children.begin(), m_children.end(), [in_child](const EntitySPtr& in_entity)
    {
        return in_entity.get() == in_child;
    });

    if(it != m_children.end())
    {
        m_transform.RemoveChildTransform(&in_child->GetTransform());

        if(m_scene != nullptr)
        {
            m_scene->Remove(in_child);
        }

        in_child->m_parent = nullptr;
        std::swap(m_children.back(), *it);
        m_children.pop_back();
    }
}
开发者ID:DNSMorgan,项目名称:ChilliSource,代码行数:26,代码来源:Entity.cpp


示例11: CS_ASSERT

		//------------------------------------------------
		//------------------------------------------------
		void PointerSystem::OnInit()
		{
			m_screen = ChilliSource::Application::Get()->GetSystem<ChilliSource::Screen>();
			CS_ASSERT(m_screen != nullptr, "Cannot find system required by PointerSystem: Screen.");

			m_mouseButtonConnection = SFMLWindow::Get()->GetMouseButtonEvent().OpenConnection(ChilliSource::MakeDelegate(this, &PointerSystem::OnMouseButtonEvent));
			m_mouseMovedConnection = SFMLWindow::Get()->GetMouseMovedEvent().OpenConnection(ChilliSource::MakeDelegate(this, &PointerSystem::OnMouseMoved));
			m_mouseWheelConnection = SFMLWindow::Get()->GetMouseWheelEvent().OpenConnection(ChilliSource::MakeDelegate(this, &PointerSystem::OnMouseWheeled));

			//create the mouse pointer
			ChilliSource::Integer2 mousePosi = SFMLWindow::Get()->GetMousePosition();
			ChilliSource::Vector2 mousePos((f32)mousePosi.x, m_screen->GetResolution().y - (f32)mousePosi.y);

			m_pointerId = AddPointerCreateEvent(mousePos);
		}
开发者ID:angelahnicole,项目名称:ChilliSource_ParticleOpt,代码行数:17,代码来源:PointerSystem.cpp


示例12: StreamingReporterBase

 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 CSReporter::CSReporter(const Catch::ReporterConfig& in_config) noexcept
     : StreamingReporterBase(in_config)
 {
     CS_ASSERT(!m_config->includeSuccessfulResults(), "CSReporter doesn't support reporting successful results.");
     CS_ASSERT(!m_config->warnAboutMissingAssertions(), "CSReporter doesn't support warning about missing assertions.");
     CS_ASSERT(!m_config->showInvisibles(), "CSReporter doesn't support showing invisibles.");
     CS_ASSERT(!m_config->showDurations(), "CSReporter doesn't support showing durations.");
     CS_ASSERT(!m_config->useColour(), "CSReporter doesn't support coloured output.");
     CS_ASSERT(!m_config->shouldDebugBreak(), "CSReporter doesn't support debug break.");
 }
开发者ID:ChilliWorks,项目名称:CSTest,代码行数:12,代码来源:CSReporter.cpp


示例13: CS_ASSERT

psMovementManager::psMovementManager(iEventNameRegistry* eventname_reg, psControlManager* controls)
{
    CS_ASSERT(eventname_reg);
    event_frame = csevFrame(eventname_reg);
    event_mousemove = csevMouseMove(eventname_reg,0);

    actor = NULL;
    this->controls = controls;

    ready = false;
    psengine->GetMsgHandler()->Subscribe(this,MSGTYPE_MOVEINFO);
    psengine->GetMsgHandler()->Subscribe(this,MSGTYPE_MOVELOCK);
    psengine->GetMsgHandler()->Subscribe(this,MSGTYPE_MOVEMOD);

    defaultmode = NULL;
    actormode = NULL;

    onGround = true;
    locked = false;
    activeMoves = 0;

    autoMove = false;
    toggleRun = false;
    mouseAutoMove = false;
    mouseLook = false;
    mouseLookCanAct = false;
    mouseZoom = false;
    mouseMove = false;
    sneaking = false;
    runToMarkerID = 0;
    lastDist = 0.0f;
    runToDiff = csVector3(0.0f);
    lastDeltaX = 0.0f;
    lastDeltaY = 0.0f;

    sensY = 1.0f;
    sensX = 1.0f;
    invertedMouse = true;
    
    activeModType = psMoveModMsg::NONE;

    forward = NULL;
    backward = NULL;
    run = NULL;
    walk = NULL;

    kbdRotate = 0;
}
开发者ID:Mixone-FinallyHere,项目名称:planeshift,代码行数:48,代码来源:psmovement.cpp


示例14: GetData

// Note: isalpha(int c),  toupper(int c), tolower(int c), isspace(int c)
// If c is not an unsigned char value, or EOF, the behaviour of these functions
// is undefined.
csStringBase &csStringBase::RTrim()
{
  if (Size > 0)
  {
    char const* const p = GetData();
    CS_ASSERT(p != 0);
    const char* c;
    for (c = p + Size - 1; c != p; c--)
      if (!isspace ((unsigned char)*c))
        break;
    size_t i = c - p;
    if (i < Size - 1)
      Truncate(i + 1);
  }
  return *this;
}
开发者ID:garinh,项目名称:cs,代码行数:19,代码来源:csstring.cpp


示例15: CS_ASSERT

 //------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------
 void ResourcePool::AddProvider(ResourceProvider* in_provider)
 {
     CS_ASSERT(in_provider != nullptr, "Cannot add null resource provider to pool");
     auto itDescriptor = m_descriptors.find(in_provider->GetResourceType());
     
     if(itDescriptor == m_descriptors.end())
     {
         PoolDesc desc;
         desc.m_providers.push_back(in_provider);
         m_descriptors.insert(std::make_pair(in_provider->GetResourceType(), desc));
     }
     else
     {
         itDescriptor->second.m_providers.push_back(in_provider);
     }
 }
开发者ID:angelahnicole,项目名称:ChilliSource_ParticleOpt,代码行数:18,代码来源:ResourcePool.cpp


示例16: CreateSTDStringFromJString

			//------------------------------------------------------------------------------
			//------------------------------------------------------------------------------
			std::string CreateSTDStringFromJString(jstring in_jString)
			{
			    if (in_jString == nullptr)
			    {
			        return "";
			    }

				auto environment = JavaVirtualMachine::Get()->GetJNIEnvironment();
                const char * cString = environment->GetStringUTFChars(in_jString, JNI_FALSE);
                CS_ASSERT(cString != nullptr, "String returned from GetStringUTFChars() cannot be null.");

                std::string output = std::string(cString);
                environment->ReleaseStringUTFChars(in_jString, cString);

                return output;
			}
开发者ID:AzCopey,项目名称:ChilliSource,代码行数:18,代码来源:JavaUtils.cpp


示例17: CS_ASSERT

        //-------------------------------------------------------
        //-------------------------------------------------------
		void TextEntry::Deactivate()
		{
            CS_ASSERT(ChilliSource::Application::Get()->GetTaskScheduler()->IsMainThread(), "Cannot deactivate system text entry outside of main thread.");
			if (m_enabled == true)
			{
				m_textEntryJI->Deactivate();
				m_enabled = false;

				if(m_textInputDeactivatedDelegate != nullptr)
				{
					auto delegate = m_textInputDeactivatedDelegate;
					m_textInputDeactivatedDelegate = nullptr;
					delegate();
				}
			}
		}
开发者ID:AzCopey,项目名称:ChilliSource,代码行数:18,代码来源:TextEntry.cpp


示例18: SetID

    bool dbRecord::Execute(uint32 uid)
    {
        SetID(uid);
        CS_ASSERT_MSG("Error: wrong number of expected fields", index == count);

        if(!prepared)
            Prepare();

        psStopWatch timer;
        timer.Start();

        CS_ASSERT(count != index);

        csStringArray paramStrings;
        const char *paramValues[index];
        for(unsigned int i = 0; i < index; i++)
        {
            csString value;
            switch(temp[i].type)
            {
                case SQL_TYPE_FLOAT:
                    value.Format("%f", temp[i].fValue);
                    break;
                case SQL_TYPE_INT:
                    value.Format("%i", temp[i].iValue);
                    break;
                case SQL_TYPE_STRING:
                    value = temp[i].sValue;
                    break;
                case SQL_TYPE_NULL:
                    break;
            }
            paramStrings.Push(value);
            paramValues[i] = paramStrings.Get(i);
        }

        PGresult *res = PQexecPrepared(conn, stmt.GetData(), index, paramValues, NULL, NULL,0);
        bool result = (res && PQresultStatus(res) != PGRES_FATAL_ERROR);
        if(result && timer.Stop() > 1000)
        {
            csString status;
            status.Format("SQL query in file %s line %d, has taken %u time to process.\n", file, line, timer.Stop());
            if(logcsv)
                logcsv->Write(CSV_STATUS, status);
        }
        return result;
    }
开发者ID:Mixone-FinallyHere,项目名称:planeshift,代码行数:47,代码来源:dal.cpp


示例19: GetTargetType

bool Client::IsAllowedToAttack(gemObject * target, bool inform)
{
    csString msg;

    int type = GetTargetType(target);
    if (type == TARGET_NONE)
        msg = "You must select a target to attack.";
    else if (type & TARGET_ITEM)
        msg = "You can't attack an inanimate object.";
    else if (type & TARGET_DEAD)
        msg = "%s is already dead.";
    else if (type & TARGET_FOE)
    {
        gemActor* foe = target->GetActorPtr();
        gemActor* attacker = GetActor();
        CS_ASSERT(foe != NULL); // Since this is a foe it should have a actor.

        gemActor* lastAttacker = NULL;
        if (target->HasKillStealProtection() && !foe->CanBeAttackedBy(attacker, &lastAttacker))
        {
            if (lastAttacker)
            {
                msg.Format("You must be grouped with %s to attack %s.",
                           lastAttacker->GetName(), foe->GetName());
            }
            else
            {
                msg = "You are not allowed to attack right now.";
            }
        }
    }
    else if (type & TARGET_FRIEND)
        msg = "You cannot attack %s.";
    else if (type & TARGET_SELF)
        msg = "You cannot attack yourself.";

    if (!msg.IsEmpty())
    {
        if (inform)
        {
            psserver->SendSystemError(clientnum, msg, target? target->GetName(): "");
        }

        return false;
    }
    return true;
}
开发者ID:garinh,项目名称:planeshift,代码行数:47,代码来源:client.cpp


示例20: CS_ASSERT

bool pawsShortcutWindow::OnFingering(csString string, psControl::Device device, uint button, uint32 mods)
{
    pawsFingeringWindow* fingWnd = dynamic_cast<pawsFingeringWindow*>(PawsManager::GetSingleton().FindWidget("FingeringWindow"));
    if (fingWnd == NULL || !fingWnd->IsVisible())
        return true;

    csString editedCmd;
    editedCmd.Format("Shortcut %d",edit+1);

    bool changed = false;

    if (string == NO_BIND)  // Removing trigger
    {
        psengine->GetCharControl()->RemapTrigger(editedCmd,psControl::NONE,0,0);
        changed = true;
    }
    else  // Changing trigger
    {
        changed = psengine->GetCharControl()->RemapTrigger(editedCmd,device,button,mods);
    }

    if (changed)
    {
        shortcutText->SetText(GetTriggerText(edit));
        return true;  // Hide fingering window
    }
    else  // Map already exists
    {
        const psControl* other = psengine->GetCharControl()->GetMappedTrigger(device,button,mods);
        CS_ASSERT(other);

        csString name = GetDisplayName(other->name);
        if (name.IsEmpty())     //then not cleaned up properly from deleting a shortcut
        {
            name = other->name; //use its numeric name
        }
        else
        {
            name.AppendFmt(" (%s)", other->name.GetDataSafe());
        }

        fingWnd->SetCollisionInfo(name);

        return false;
    }
}
开发者ID:randomcoding,项目名称:PlaneShift-PSAI,代码行数:46,代码来源:shortcutwindow.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CS_CHECK函数代码示例发布时间:2022-05-30
下一篇:
C++ CSYNC_LOG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap