📄 stringbuffer_chn.cc
字号:
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
#include "core/stringBuffer.h"
//#include "core/frameAllocator.h"
//#include "core/unicode.h"
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//
//void StringBuffer::set(const StringBuffer *in)
//{
// // Copy the vector.
// mBuffer.setSize(in->length()+1);
// dMemcpy(mBuffer.address(), in->mBuffer.address(), sizeof(UTF8)*in->mBuffer.size());
//}
//
//
//
//
//void StringBuffer::set(const UTF8 *in)
//{
// // Convert and store. Note that a UTF16 version of the string cannot be longer.
// U32 nSize = dStrlen(in)+1;
//
// // Otherwise, we've a copy to do. (This might not be strictly necessary.)
// mBuffer.setSize(nSize);
// dMemcpy(mBuffer.address(), in , sizeof(UTF8) * nSize);
// mBuffer.compact();
// AssertFatal(mBuffer.last() == 0, "StringBuffer::set UTF8 - not a null terminated string!");
//}
//
//void StringBuffer::set(const UTF16 *in)
//{
// set((const UTF8 *)in);
//}
//
////-------------------------------------------------------------------------
//
//void StringBuffer::append(const StringBuffer &in)
//{
// // Stick in onto the end of us - first make space.
// U32 oldSize = length();
// mBuffer.increment(in.length());
//
// // Copy it in, ignoring both our terminator and theirs.
// dMemcpy(&mBuffer[oldSize], in.mBuffer.address(), sizeof(UTF8)*in.length());
//
// // Terminate the string.
// mBuffer.last() = 0;
//}
//
//void StringBuffer::insert(const U32 charOffset, const StringBuffer &in)
//{
// // Deal with append case.
// if(charOffset >= length())
// {
// append(in);
// return;
// }
//
// // Append was easy, now we have to do some work.
//
// // Make some space in our buffer. We only need in.length() more as we
// // will be dropping one of the two terminators present in this operation.
// mBuffer.increment(in.length());
//
// // Copy everything we have that comes after charOffset past where the new
// // string data will be.
//
// // Figure the address to start copying at. We know this is ok as otherwise
// // we'd be in the append case.
// const UTF8 *copyStart = &mBuffer[charOffset];
//
// // Figure the number of UTF16's to copy, taking into account the possibility
// // that we may be inserting a long string into a short string.
//
// // We want to copy in.length() chars up, but there may not be that many available.
// // So we want to really do either in.length() or length()-charOffset, whichever
// // is lower.
// const U32 copyCharLength = (S32)(length() - charOffset);
//
// // Don't copy unless we have to.
// if(copyCharLength)
// {
// for(S32 i=copyCharLength-1; i>=0; i--)
// mBuffer[charOffset+i+in.length()] = mBuffer[charOffset+i];
//
// // Can't copy directly, it messes up sometimes, esp. in release mode builds.
// //dMemcpy(&mBuffer[charOffset+in.length()], &mBuffer[charOffset], sizeof(UTF16) * copyCharLength);
// }
//
// // And finally copy the new data in, not including its terminator.
// dMemcpy(&mBuffer[charOffset], in.mBuffer.address(), sizeof(UTF8) * in.length());
//
// // All done!
// AssertFatal(mBuffer.last() == 0, "StringBuffer::insert - not a null terminated string!");
//}
//
//
//
//
////-------------------------------------------------------------------------
//
//void StringBuffer::get(UTF8 *buff, const U32 buffSize) const
//{
// AssertFatal(mBuffer.last() == 0, "StringBuffer::get UTF8 - not a null terminated string!");
// dMemcpy(buff, mBuffer.address(), sizeof(UTF8) * buffSize);
//}
//
//void StringBuffer::get(UTF16 *buff, const U32 buffSize) const
//{
// // Just copy it out.
// AssertFatal(mBuffer.last() == 0, "StringBuffer::get UTF8 - not a null terminated string!");
// get((UTF8 *)buff, buffSize*sizeof(UTF16) / sizeof(UTF8));
////dMemcpy(buff, mBuffer.address(), mBuffer.memSize());
//}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -