Пример #1
0
        //-------------------------------------------------------------
		//-------------------------------------------------------------
		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();
                    }
                }
            }
		}
Пример #2
0
 //------------------------------------------------------------------------------
 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.");
 }
Пример #3
0
 //----------------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------------
 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);
 }
Пример #4
0
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);
}
Пример #5
0
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;
}
Пример #6
0
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 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();
 }
Пример #7
0
 //------------------------------------------------------------------------------
 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;
 }
Пример #8
0
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;
}
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 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;
 }
Пример #10
0
//-------------------------------------------------------------
//-------------------------------------------------------------
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();
    }
}
		//------------------------------------------------
		//------------------------------------------------
		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);
		}
Пример #12
0
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 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.");
 }
Пример #13
0
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;
}
Пример #14
0
// 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;
}
Пример #15
0
csStringBase &csStringBase::Insert (size_t iPos, const char* str)
{
  CS_ASSERT(iPos <= Size);

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

  size_t const sl = strlen (str);
  size_t const NewSize = sl + Size;
  ExpandIfNeeded (NewSize);
  char* p = GetDataMutable();                         // GLOBAL NOTE *2*
  memmove (p + iPos + sl, p + iPos, Size - iPos + 1); // GLOBAL NOTE *1*
  memcpy (p + iPos, str, sl);
  Size = NewSize;
  return *this;
}
 //------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------
 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);
     }
 }
Пример #17
0
			//------------------------------------------------------------------------------
			//------------------------------------------------------------------------------
			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;
			}
Пример #18
0
        //-------------------------------------------------------
        //-------------------------------------------------------
		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();
				}
			}
		}
Пример #19
0
    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;
    }
Пример #20
0
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;
}
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;
    }
}
Пример #22
0
			//------------------------------------------------------------------------------
			//------------------------------------------------------------------------------
			std::string CreateSTDStringFromJByteArray(jbyteArray in_array, u32 in_length)
			{
			    if (in_array == nullptr || in_length == 0)
			    {
			        return "";
			    }

				auto environment = JavaVirtualMachine::Get()->GetJNIEnvironment();

                jbyte* bytes = environment->GetByteArrayElements(in_array, JNI_FALSE);
                CS_ASSERT(bytes != nullptr, "Bytes returned by GetByteArrayElements() cannot be null.");

                std::string strOutput((const char*)bytes, in_length);
                environment->ReleaseByteArrayElements(in_array, bytes, 0);

                return strOutput;
			}
Пример #23
0
void csMeshGenerator::SelfDestruct ()
{
  if (GetSector ())
  {
    size_t c = GetSector ()->GetMeshGeneratorCount ();
    while (c > 0)
    {
      c--;
      if (GetSector ()->GetMeshGenerator (c) == (iMeshGenerator*)this)
      {
        GetSector ()->RemoveMeshGenerator (c);
        return;
      }
    }
    CS_ASSERT (false);
  }
}
Пример #24
0
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 VListLayoutDef::VListLayoutDef(const Json::Value& in_json)
 {
     const char k_typeKey[] = "Type";
     const char k_numCellsKey[] = "NumCells";
     const char k_relativeMarginsKey[] = "RelMargins";
     const char k_absoluteMarginsKey[] = "AbsMargins";
     const char k_relativeSpacingKey[] = "RelSpacing";
     const char k_absoluteSpacingKey[] = "AbsSpacing";
     
     for(auto it = in_json.begin(); it != in_json.end(); ++it)
     {
         CS_ASSERT((*it).isString() == true, "All properties in a Layout Description must be a string: " + std::string(it.memberName()));
         
         std::string key = it.memberName();
         std::string value = (*it).asString();
         
         if (key == k_relativeMarginsKey)
         {
             m_relativeMargins = Core::ParseVector4(value);
         }
         else if (key == k_absoluteMarginsKey)
         {
             m_absoluteMargins = Core::ParseVector4(value);
         }
         else if (key == k_numCellsKey)
         {
             m_numCells = Core::ParseU32(value);
         }
         else if (key == k_relativeSpacingKey)
         {
             m_relativeSpacing = Core::ParseF32(value);
         }
         else if (key == k_absoluteSpacingKey)
         {
             m_absoluteSpacing = Core::ParseF32(value);
         }
         else if (key == k_typeKey)
         {
             //ignore
         }
         else
         {
             CS_LOG_FATAL("Invalid property found in a List layout description: " + key);
         }
     }
 }
		//-------------------------------------------
		//-------------------------------------------
		void ParticleSystem::RemoveParticleComponent(ParticleComponent* in_particle)
		{
            CS_ASSERT(in_particle != nullptr, "Cannot remove null particle");
            
            u32 numParticles = m_particleComponents.size();
            for(u32 i=0; i<numParticles; ++i)
            {
                if(m_particleComponents[i] == in_particle)
                {
                    //Swap and pop
                    m_particleComponents[i]->SetOwningSystem(nullptr);
                    m_particleComponents[i] = m_particleComponents.back();
                    m_particleComponents.pop_back();
                    return;
                }
            }
		}
Пример #26
0
        //-----------------------------------------------------
        void BackButtonSystem::OnDeviceButtonPressed(const CS::DeviceButtonSystem::DeviceButton& buttonPressed) noexcept
        {
            if (buttonPressed == CS::DeviceButtonSystem::DeviceButton::k_backButton)
            {
                auto stateManager = CS::Application::Get()->GetStateManager();
                CS_ASSERT(stateManager, "No state manager active.");

                if (stateManager->GetNumStates() > 1)
                {
                    stateManager->Pop();
                }
                else
                {
                    CS::Application::Get()->Quit();
                }
            }
        }
Пример #27
0
 //------------------------------------------------------------------------------
 GLuint GLTextureUnitManager::BindAdditional(const ChilliSource::RenderTexture* texture) noexcept
 {
     GLuint textureIndex = GetNextAvailableUnit();
     
     m_boundTextures.push_back(texture);
     
     auto glTexture = static_cast<GLTexture*>(texture->GetExtraData());
     CS_ASSERT(glTexture, "Cannot bind a texture which hasn't been loaded.");
     
     glActiveTexture(GL_TEXTURE0 + textureIndex);
     glBindTexture(GL_TEXTURE_2D, glTexture->GetHandle());
     glActiveTexture(GL_TEXTURE0);
     
     CS_ASSERT_NOGLERROR("An OpenGL error occurred while binding an additional texture.");
     
     return textureIndex;
 }
Пример #28
0
csRef<iDocument> ParseString(const csString & str, bool notify)
{
    csRef<iDocumentSystem> xml;
    xml.AttachNew(new csTinyDocumentSystem);
    CS_ASSERT(xml != NULL);
    csRef<iDocument> doc  = xml->CreateDocument();
    const char* error = doc->Parse(str);
    if (error)
    {
        if (notify)
        {
            Error3("Error in XML: %s\nString was: %s", error, str.GetDataSafe());
        }
        return NULL;
    }
    return doc;
}
Пример #29
0
 //----------------------------------------------------
 //----------------------------------------------------
 void ToCSV(const std::vector<std::string>& in_values, std::string& out_csv)
 {
     if(in_values.empty())
         return;
     
     CS_ASSERT(in_values.size() < static_cast<std::size_t>(std::numeric_limits<u32>::max()), "Too many CSV items. It cannot exceed " + Core::ToString(std::numeric_limits<u32>::max()) + ".");
     
     u32 numVals = static_cast<u32>(in_values.size()) - 1;
     for(u32 i=0; i<numVals; ++i)
     {
         out_csv += in_values[i];
         out_csv += ",";
     }
     
     //Add the last one without a following comma
     out_csv += in_values[numVals];
 }
Пример #30
0
csStringBase &csStringBase::Append (const char *iStr, size_t iCount)
{
  /* Since "" is not the same as 0, make an empty string if a non-null 
     empty string is appended to a 0 string. */
  if (iStr == 0 || ((iCount == 0) && (Size != 0)))
    return *this;
  if (iCount == (size_t)-1)
    iCount = strlen (iStr);

  size_t const NewSize = Size + iCount;
  ExpandIfNeeded (NewSize);
  char* p = GetDataMutable(); // GLOBAL NOTE *2*
  CS_ASSERT(p != 0);
  memcpy (p + Size, iStr, iCount);
  Size = NewSize;
  p [Size] = '\0';
  return *this;
}