本文整理汇总了C++中core::stringc::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ stringc::c_str方法的具体用法?C++ stringc::c_str怎么用?C++ stringc::c_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::stringc
的用法示例。
在下文中一共展示了stringc::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeMeshASCII
bool CSTLMeshWriter::writeMeshASCII(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
{
// write STL MESH header
file->write("solid ",6);
const core::stringc name(SceneManager->getMeshCache()->getMeshFilename(mesh));
file->write(name.c_str(),name.size());
file->write("\n\n",2);
// write mesh buffers
for (u32 i=0; i<mesh->getMeshBufferCount(); ++i)
{
IMeshBuffer* buffer = mesh->getMeshBuffer(i);
if (buffer)
{
const u16 indexCount = buffer->getIndexCount();
switch(buffer->getVertexType())
{
case video::EVT_STANDARD:
{
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
for (u32 j=0; j<indexCount; j+=3)
writeFace(file,
vtx[buffer->getIndices()[j]].Pos,
vtx[buffer->getIndices()[j+1]].Pos,
vtx[buffer->getIndices()[j+2]].Pos);
}
break;
case video::EVT_2TCOORDS:
{
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
for (u32 j=0; j<indexCount; j+=3)
writeFace(file,
vtx[buffer->getIndices()[j]].Pos,
vtx[buffer->getIndices()[j+1]].Pos,
vtx[buffer->getIndices()[j+2]].Pos);
}
break;
case video::EVT_TANGENTS:
{
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
for (u32 j=0; j<indexCount; j+=3)
writeFace(file,
vtx[buffer->getIndices()[j]].Pos,
vtx[buffer->getIndices()[j+1]].Pos,
vtx[buffer->getIndices()[j+2]].Pos);
}
break;
}
file->write("\n",1);
}
}
file->write("endsolid ",9);
file->write(name.c_str(),name.size());
return true;
}
示例2: getAbsolutePath
core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
{
c8 *p=0;
#ifdef _IRR_WINDOWS_API_
#if !defined ( _WIN32_WCE )
c8 fpath[_MAX_PATH];
p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
#endif
#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
c8 fpath[4096];
fpath[0]=0;
p = realpath(filename.c_str(), fpath);
if (!p)
{
// content in fpath is undefined at this point
if ('0'==fpath[0]) // seems like fpath wasn't altered
{
// at least remove a ./ prefix
if ('.'==filename[0] && '/'==filename[1])
return filename.subString(2, filename.size()-2);
else
return filename;
}
else
return core::stringc(fpath);
}
#endif
return core::stringc(p);
}
示例3: writeMeshASCII
bool CSTLMeshWriter::writeMeshASCII(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
{
// write STL MESH header
file->write("solid ",6);
const core::stringc name(SceneManager->getMeshCache()->getMeshName(mesh));
file->write(name.c_str(),name.size());
file->write("\n\n",2);
// write mesh buffers
for (u32 i=0; i<mesh->getMeshBufferCount(); ++i)
{
IMeshBuffer* buffer = mesh->getMeshBuffer(i);
if (buffer)
{
const u32 indexCount = buffer->getIndexCount();
for (u32 j=0; j<indexCount; j+=3)
{
writeFace(file,
buffer->getPosition(buffer->getIndices()[j]),
buffer->getPosition(buffer->getIndices()[j+1]),
buffer->getPosition(buffer->getIndices()[j+2]));
}
file->write("\n",1);
}
}
file->write("endsolid ",9);
file->write(name.c_str(),name.size());
return true;
}
示例4: getTextColor
const c8* CTextSceneNode::getSceneCorePropertiesXMLString()
{
core::stringc str;
static core::stringc xmlstr;
xmlstr = "";
if (getMaterialsCount() == 1)
{
const c8* mat_xml = SCENE_MANAGER.getMaterialXMLText(getMaterial(0));
xmlstr.append(mat_xml);
}
str.sprintf(
"<Font filename=\"%s\" size=\"%d/\" />\n",
m_Font->getFileName(), m_Font->getSize()
);
xmlstr.append(str);
str.sprintf(
"<Text value=\"%s\" />\n",
core::stringc(getText()).c_str()
);
xmlstr.append(str);
img::SColor c = getTextColor();
str.sprintf(
"<TextColor value=\"%d,%d,%d,%d\" />\n",
c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()
);
xmlstr.append(str);
return xmlstr.c_str();
}
示例5: deletePathFromFilename
//! deletes the path from a filename
void CPakReader::deletePathFromFilename(core::stringc& filename)
{
// delete path from filename
const c8* p = filename.c_str() + filename.size();
// search for path separator or beginning
while (*p!='/' && *p!='\\' && p!=filename.c_str())
--p;
if (p != filename.c_str())
{
++p;
filename = p;
}
}
示例6: writeMeshBinary
bool CSTLMeshWriter::writeMeshBinary(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
{
// write STL MESH header
file->write("binary ",7);
const core::stringc name(SceneManager->getMeshCache()->getMeshName(mesh));
const s32 sizeleft = 73-name.size(); // 80 byte header
if (sizeleft<0)
file->write(name.c_str(),73);
else
{
char* buf = new char[80];
memset(buf, 0, 80);
file->write(name.c_str(),name.size());
file->write(buf,sizeleft);
delete [] buf;
}
u32 facenum = 0;
for (u32 j=0; j<mesh->getMeshBufferCount(); ++j)
facenum += mesh->getMeshBuffer(j)->getIndexCount()/3;
file->write(&facenum,4);
// write mesh buffers
for (u32 i=0; i<mesh->getMeshBufferCount(); ++i)
{
IMeshBuffer* buffer = mesh->getMeshBuffer(i);
if (buffer)
{
const u32 indexCount = buffer->getIndexCount();
const u16 attributes = 0;
for (u32 j=0; j<indexCount; j+=3)
{
const core::vector3df& v1 = buffer->getPosition(buffer->getIndices()[j]);
const core::vector3df& v2 = buffer->getPosition(buffer->getIndices()[j+1]);
const core::vector3df& v3 = buffer->getPosition(buffer->getIndices()[j+2]);
const core::plane3df tmpplane(v1,v2,v3);
file->write(&tmpplane.Normal, 12);
file->write(&v1, 12);
file->write(&v2, 12);
file->write(&v3, 12);
file->write(&attributes, 2);
}
}
}
return true;
}
示例7: Device
CShaderMaterial::CShaderMaterial(IrrlichtDevice* device, const core::stringc& name,
io::path vsFile, core::stringc vsEntry, video::E_VERTEX_SHADER_TYPE vsType,
io::path psFile, core::stringc psEntry, video::E_PIXEL_SHADER_TYPE psType,
video::E_MATERIAL_TYPE baseMaterial) : Device(device), Name(name), PixelShaderFlags(0), VertexShaderFlags(0)
{
s32 userdata = 0;
io::path vsPath;
io::path psPath;
// log action
core::stringc msg = core::stringc("compiling material ") + name;
Device->getLogger()->log(msg.c_str(), ELL_INFORMATION);
// create destination path for (driver specific) shader files
if(Device->getVideoDriver()->getDriverType() == video::EDT_OPENGL)
{
vsPath = core::stringc("./shaders/glsl/") + vsFile;
psPath = core::stringc("./shaders/glsl/") + psFile;
userdata = 1;
}
if(Device->getVideoDriver()->getDriverType() == video::EDT_DIRECT3D9)
{
vsPath=core::stringc("./shaders/hlsl/") + vsFile;
psPath=core::stringc("./shaders/hlsl/") + psFile;
userdata = 0;
}
// create shader material
video::IGPUProgrammingServices* gpu = Device->getVideoDriver()->getGPUProgrammingServices();
s32 matID = gpu->addHighLevelShaderMaterialFromFiles(
vsPath, vsEntry.c_str(), vsType,
psPath, psEntry.c_str(), psType,
this, baseMaterial, userdata);
// set material type
Material.MaterialType = (video::E_MATERIAL_TYPE)matID;
// set the default texturenames and texture wrap
// these are overridden by the effect.xml configuration
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i)
{
TextureName[i] = core::stringc("texture") + core::stringc(i);
Material.TextureLayer[i].TextureWrapU = video::ETC_REPEAT;
Material.TextureLayer[i].TextureWrapV = video::ETC_REPEAT;
}
}
示例8: getStatAsInteger
s32 PlayerManager::getStatAsInteger(const core::stringw& key) const
{
const core::stringc s = getStat(key);
if (s.empty())
return 0;
return core::strtol10(s.c_str());
}
示例9: resRoot
Address::Address(core::stringc addr, core::stringc port)
: resRoot(0), resActive(0)
{
Startup();
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_protocol = SOCK_STREAM;
int error = 0;
error = getaddrinfo(addr.c_str(), port.c_str() , &hints, &resRoot);
if(error)
{
printf("getaddrinfo failed... %s %s %s\n", addr.c_str(), port.c_str(), gai_strerror(error));
freeaddrinfo(resRoot);
resRoot = resActive = 0;
return;
}
};
示例10: deletePathFromFilename
//! deletes the path from a filename
void CPakReader::deletePathFromFilename(core::stringc& filename)
{
// delete path from filename
const c8* p = filename.c_str() + filename.size();
// suche ein slash oder den anfang.
while (*p!='/' && *p!='\\' && p!=filename.c_str())
--p;
core::stringc newName;
if (p != filename.c_str())
{
++p;
filename = p;
}
}
示例11: getConfigForGamepad
/**
* Check if we already have a config object for gamepad 'irr_id' as reported by
* irrLicht, If no, create one. Returns true if new configuration was created,
* otherwise false.
*/
bool DeviceManager::getConfigForGamepad(const int irr_id,
const core::stringc& name,
GamepadConfig **config)
{
bool found = false;
bool configCreated = false;
// Find appropriate configuration
for(unsigned int n=0; n < m_gamepad_configs.size(); n++)
{
if(m_gamepad_configs[n].getName() == name.c_str())
{
*config = m_gamepad_configs.get(n);
found = true;
}
}
// If we can't find an appropriate configuration then create one.
if (!found)
{
if(irr_id < (int)(m_irrlicht_gamepads.size()))
{
*config = new GamepadConfig( name.c_str(),
m_irrlicht_gamepads[irr_id].Axes,
m_irrlicht_gamepads[irr_id].Buttons );
}
#ifdef ENABLE_WIIUSE
else // Wiimotes have a higher ID and do not refer to m_irrlicht_gamepads
{
// The Wiimote manager will set number of buttons and axis
*config = new GamepadConfig(name.c_str());
}
#endif
// Add new config to list
m_gamepad_configs.push_back(*config);
configCreated = true;
}
return configCreated;
}
示例12: getAbsolutePath
core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
{
c8 *p=0;
core::stringc ret;
#ifdef _IRR_WINDOWS_API_
c8 fpath[_MAX_PATH];
p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
ret = p;
#elif (defined(_IRR_POSIX_API_) || defined(MACOSX))
c8 fpath[4096];
p = realpath(filename.c_str(), fpath);
ret = p;
#endif
return ret;
}
示例13: populateTreeView
bool CGUISkinSystem::populateTreeView(gui::IGUITreeView *control,const core::stringc& skinname) {
bool ret = false;
io::path oldpath = fs->getWorkingDirectory();
fs->changeWorkingDirectoryTo(skinsPath);
registry = new CXMLRegistry(fs);
if(!registry->loadFile(SKINSYSTEM_SKINFILE,skinname.c_str())) {
return ret;
}
ret = registry->populateTreeView(control);
delete registry;
registry = NULL;
fs->changeWorkingDirectoryTo(oldpath);
return ret;
}
示例14:
//! sets the caption of the window
void CIrrDeviceWin32::setWindowCaption(const wchar_t* text)
{
DWORD dwResult;
if (IsNonNTWindows)
{
const core::stringc s = text;
SendMessageTimeout(HWnd, WM_SETTEXT, 0,
reinterpret_cast<LPARAM>(s.c_str()),
SMTO_ABORTIFHUNG, 2000, &dwResult);
}
else
SendMessageTimeoutW(HWnd, WM_SETTEXT, 0,
reinterpret_cast<LPARAM>(text),
SMTO_ABORTIFHUNG, 2000, &dwResult);
}
示例15:
//!
const c8* CTestSceneNode::getSceneCorePropertiesXMLString()
{
static core::stringc xmlstr;
xmlstr = "";
if (getMaterialsCount() == 1)
{
const c8* mat_xml = SCENE_MANAGER.getMaterialXMLText(getMaterial(0));
xmlstr.append(mat_xml);
}
xmlstr.sprintf("<GeomPrimitive type=\"%s\" />\n",
GeomPrimitiveTypeStr[m_GeomPrimitiveType]);
return xmlstr.c_str();
}