mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-11 21:00:35 +01:00
296 lines
28 KiB
HTML
296 lines
28 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
|
<title>Irrlicht 3D Engine: coreutil.h Source File</title>
|
||
|
|
||
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="jquery.js"></script>
|
||
|
<script type="text/javascript" src="resize.js"></script>
|
||
|
<script type="text/javascript" src="navtree.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(initResizable);
|
||
|
</script>
|
||
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="search/search.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
||
|
</script>
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="top"><!-- do not remove this div! -->
|
||
|
|
||
|
|
||
|
<div id="titlearea">
|
||
|
<table cellspacing="0" cellpadding="0">
|
||
|
<tbody>
|
||
|
<tr style="height: 56px;">
|
||
|
|
||
|
<td id="projectlogo"><img alt="Logo" src="irrlichtlogo.png"/></td>
|
||
|
|
||
|
|
||
|
<td style="padding-left: 0.5em;">
|
||
|
<div id="projectname">Irrlicht 3D Engine
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<td> <div id="MSearchBox" class="MSearchBoxInactive">
|
||
|
<span class="left">
|
||
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
||
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
alt=""/>
|
||
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
||
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
||
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
||
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
||
|
</span><span class="right">
|
||
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
||
|
</span>
|
||
|
</div>
|
||
|
</td>
|
||
|
|
||
|
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<!-- Generated by Doxygen 1.7.5.1 -->
|
||
|
<script type="text/javascript">
|
||
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||
|
</script>
|
||
|
<script type="text/javascript" src="dynsections.js"></script>
|
||
|
</div>
|
||
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||
|
<div id="nav-tree">
|
||
|
<div id="nav-tree-contents">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="splitbar" style="-moz-user-select:none;"
|
||
|
class="ui-resizable-handle">
|
||
|
</div>
|
||
|
</div>
|
||
|
<script type="text/javascript">
|
||
|
initNavTree('coreutil_8h.html','');
|
||
|
</script>
|
||
|
<div id="doc-content">
|
||
|
<div class="header">
|
||
|
<div class="headertitle">
|
||
|
<div class="title">coreutil.h</div> </div>
|
||
|
</div>
|
||
|
<div class="contents">
|
||
|
<a href="coreutil_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2002-2012 Nikolaus Gebhardt</span>
|
||
|
<a name="l00002"></a>00002 <span class="comment">// This file is part of the "Irrlicht Engine".</span>
|
||
|
<a name="l00003"></a>00003 <span class="comment">// For conditions of distribution and use, see copyright notice in irrlicht.h</span>
|
||
|
<a name="l00004"></a>00004
|
||
|
<a name="l00005"></a>00005 <span class="preprocessor">#ifndef __IRR_CORE_UTIL_H_INCLUDED__</span>
|
||
|
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define __IRR_CORE_UTIL_H_INCLUDED__</span>
|
||
|
<a name="l00007"></a>00007 <span class="preprocessor"></span>
|
||
|
<a name="l00008"></a>00008 <span class="preprocessor">#include "<a class="code" href="irr_string_8h.html">irrString.h</a>"</span>
|
||
|
<a name="l00009"></a>00009 <span class="preprocessor">#include "<a class="code" href="path_8h.html">path.h</a>"</span>
|
||
|
<a name="l00010"></a>00010
|
||
|
<a name="l00011"></a>00011 <span class="keyword">namespace </span>irr
|
||
|
<a name="l00012"></a>00012 {
|
||
|
<a name="l00013"></a>00013 <span class="keyword">namespace </span>core
|
||
|
<a name="l00014"></a>00014 {
|
||
|
<a name="l00015"></a>00015
|
||
|
<a name="l00020"></a>00020 <span class="comment">// ----------- some basic quite often used string functions -----------------</span>
|
||
|
<a name="l00021"></a>00021
|
||
|
<a name="l00023"></a><a class="code" href="namespaceirr_1_1core.html#ab214253f8925de2ed42a7d671d02cf7f">00023</a> <span class="keyword">inline</span> <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> <a class="code" href="namespaceirr_1_1core.html#ab214253f8925de2ed42a7d671d02cf7f" title="search if a filename has a proper extension">isFileExtension</a> ( <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& filename,
|
||
|
<a name="l00024"></a>00024 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& ext0,
|
||
|
<a name="l00025"></a>00025 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& ext1,
|
||
|
<a name="l00026"></a>00026 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& ext2)
|
||
|
<a name="l00027"></a>00027 {
|
||
|
<a name="l00028"></a>00028 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> extPos = filename.<a class="code" href="classirr_1_1core_1_1string.html#a000258d8ce7a49ba10d20bfb8d9d3ad8" title="finds last occurrence of character in string">findLast</a> ( <span class="charliteral">'.'</span> );
|
||
|
<a name="l00029"></a>00029 <span class="keywordflow">if</span> ( extPos < 0 )
|
||
|
<a name="l00030"></a>00030 <span class="keywordflow">return</span> 0;
|
||
|
<a name="l00031"></a>00031
|
||
|
<a name="l00032"></a>00032 extPos += 1;
|
||
|
<a name="l00033"></a>00033 <span class="keywordflow">if</span> ( filename.<a class="code" href="classirr_1_1core_1_1string.html#adf74d5a6ce1a2ed79b4b06d51e899602" title="Compares the strings ignoring case.">equals_substring_ignore_case</a> ( ext0, extPos ) ) <span class="keywordflow">return</span> 1;
|
||
|
<a name="l00034"></a>00034 <span class="keywordflow">if</span> ( filename.<a class="code" href="classirr_1_1core_1_1string.html#adf74d5a6ce1a2ed79b4b06d51e899602" title="Compares the strings ignoring case.">equals_substring_ignore_case</a> ( ext1, extPos ) ) <span class="keywordflow">return</span> 2;
|
||
|
<a name="l00035"></a>00035 <span class="keywordflow">if</span> ( filename.<a class="code" href="classirr_1_1core_1_1string.html#adf74d5a6ce1a2ed79b4b06d51e899602" title="Compares the strings ignoring case.">equals_substring_ignore_case</a> ( ext2, extPos ) ) <span class="keywordflow">return</span> 3;
|
||
|
<a name="l00036"></a>00036 <span class="keywordflow">return</span> 0;
|
||
|
<a name="l00037"></a>00037 }
|
||
|
<a name="l00038"></a>00038
|
||
|
<a name="l00040"></a><a class="code" href="namespaceirr_1_1core.html#a7a0c7be24d78c02b334c3ae5a18005a1">00040</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceirr_1_1core.html#a7a0c7be24d78c02b334c3ae5a18005a1" title="search if a filename has a proper extension">hasFileExtension</a> ( <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& filename,
|
||
|
<a name="l00041"></a>00041 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& ext0,
|
||
|
<a name="l00042"></a>00042 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& ext1 = <span class="stringliteral">""</span>,
|
||
|
<a name="l00043"></a>00043 <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& ext2 = <span class="stringliteral">""</span>)
|
||
|
<a name="l00044"></a>00044 {
|
||
|
<a name="l00045"></a>00045 <span class="keywordflow">return</span> <a class="code" href="namespaceirr_1_1core.html#ab214253f8925de2ed42a7d671d02cf7f" title="search if a filename has a proper extension">isFileExtension</a> ( filename, ext0, ext1, ext2 ) > 0;
|
||
|
<a name="l00046"></a>00046 }
|
||
|
<a name="l00047"></a>00047
|
||
|
<a name="l00049"></a><a class="code" href="namespaceirr_1_1core.html#a188da2e914c6d4a6535bee08565d877b">00049</a> <span class="keyword">inline</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& <a class="code" href="namespaceirr_1_1core.html#a188da2e914c6d4a6535bee08565d877b" title="cut the filename extension from a source file path and store it in a dest file path">cutFilenameExtension</a> ( <a class="code" href="classirr_1_1core_1_1string.html">io::path</a> &dest, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a> &source )
|
||
|
<a name="l00050"></a>00050 {
|
||
|
<a name="l00051"></a>00051 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> endPos = source.<a class="code" href="classirr_1_1core_1_1string.html#a000258d8ce7a49ba10d20bfb8d9d3ad8" title="finds last occurrence of character in string">findLast</a> ( <span class="charliteral">'.'</span> );
|
||
|
<a name="l00052"></a>00052 dest = source.<a class="code" href="classirr_1_1core_1_1string.html#ad3d16f4aa3c4295f46d86b7bc525450f" title="Returns a substring.">subString</a> ( 0, endPos < 0 ? source.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a> () : endPos );
|
||
|
<a name="l00053"></a>00053 <span class="keywordflow">return</span> dest;
|
||
|
<a name="l00054"></a>00054 }
|
||
|
<a name="l00055"></a>00055
|
||
|
<a name="l00057"></a><a class="code" href="namespaceirr_1_1core.html#abebbe8b229dc865ebeb9bb0fd367d6ea">00057</a> <span class="keyword">inline</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& <a class="code" href="namespaceirr_1_1core.html#abebbe8b229dc865ebeb9bb0fd367d6ea" title="get the filename extension from a file path">getFileNameExtension</a> ( <a class="code" href="classirr_1_1core_1_1string.html">io::path</a> &dest, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a> &source )
|
||
|
<a name="l00058"></a>00058 {
|
||
|
<a name="l00059"></a>00059 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> endPos = source.<a class="code" href="classirr_1_1core_1_1string.html#a000258d8ce7a49ba10d20bfb8d9d3ad8" title="finds last occurrence of character in string">findLast</a> ( <span class="charliteral">'.'</span> );
|
||
|
<a name="l00060"></a>00060 <span class="keywordflow">if</span> ( endPos < 0 )
|
||
|
<a name="l00061"></a>00061 dest = <span class="stringliteral">""</span>;
|
||
|
<a name="l00062"></a>00062 <span class="keywordflow">else</span>
|
||
|
<a name="l00063"></a>00063 dest = source.<a class="code" href="classirr_1_1core_1_1string.html#ad3d16f4aa3c4295f46d86b7bc525450f" title="Returns a substring.">subString</a> ( endPos, source.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a> () );
|
||
|
<a name="l00064"></a>00064 <span class="keywordflow">return</span> dest;
|
||
|
<a name="l00065"></a>00065 }
|
||
|
<a name="l00066"></a>00066
|
||
|
<a name="l00068"></a><a class="code" href="namespaceirr_1_1core.html#a905c95bab4a7e8d5360a19b0726383a9">00068</a> <span class="keyword">inline</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& <a class="code" href="namespaceirr_1_1core.html#a905c95bab4a7e8d5360a19b0726383a9" title="delete path from filename">deletePathFromFilename</a>(<a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& filename)
|
||
|
<a name="l00069"></a>00069 {
|
||
|
<a name="l00070"></a>00070 <span class="comment">// delete path from filename</span>
|
||
|
<a name="l00071"></a>00071 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a813cca9bac9fa0c1427d89720a451460" title="Type name for character type used by the file system.">fschar_t</a>* s = filename.<a class="code" href="classirr_1_1core_1_1string.html#a4abad222c478c108096ee9297870068c" title="Returns character string.">c_str</a>();
|
||
|
<a name="l00072"></a>00072 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a813cca9bac9fa0c1427d89720a451460" title="Type name for character type used by the file system.">fschar_t</a>* p = s + filename.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a>();
|
||
|
<a name="l00073"></a>00073
|
||
|
<a name="l00074"></a>00074 <span class="comment">// search for path separator or beginning</span>
|
||
|
<a name="l00075"></a>00075 <span class="keywordflow">while</span> ( *p != <span class="charliteral">'/'</span> && *p != <span class="charliteral">'\\'</span> && p != s )
|
||
|
<a name="l00076"></a>00076 p--;
|
||
|
<a name="l00077"></a>00077
|
||
|
<a name="l00078"></a>00078 <span class="keywordflow">if</span> ( p != s )
|
||
|
<a name="l00079"></a>00079 {
|
||
|
<a name="l00080"></a>00080 ++p;
|
||
|
<a name="l00081"></a>00081 filename = p;
|
||
|
<a name="l00082"></a>00082 }
|
||
|
<a name="l00083"></a>00083 <span class="keywordflow">return</span> filename;
|
||
|
<a name="l00084"></a>00084 }
|
||
|
<a name="l00085"></a>00085
|
||
|
<a name="l00087"></a><a class="code" href="namespaceirr_1_1core.html#a9215d20e34c12cb6c1522366389bfcce">00087</a> <span class="keyword">inline</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& <a class="code" href="namespaceirr_1_1core.html#a9215d20e34c12cb6c1522366389bfcce" title="trim paths">deletePathFromPath</a>(<a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& filename, <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> pathCount)
|
||
|
<a name="l00088"></a>00088 {
|
||
|
<a name="l00089"></a>00089 <span class="comment">// delete path from filename</span>
|
||
|
<a name="l00090"></a>00090 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> i = filename.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a>();
|
||
|
<a name="l00091"></a>00091
|
||
|
<a name="l00092"></a>00092 <span class="comment">// search for path separator or beginning</span>
|
||
|
<a name="l00093"></a>00093 <span class="keywordflow">while</span> ( i>=0 )
|
||
|
<a name="l00094"></a>00094 {
|
||
|
<a name="l00095"></a>00095 <span class="keywordflow">if</span> ( filename[i] == <span class="charliteral">'/'</span> || filename[i] == <span class="charliteral">'\\'</span> )
|
||
|
<a name="l00096"></a>00096 {
|
||
|
<a name="l00097"></a>00097 <span class="keywordflow">if</span> ( --pathCount <= 0 )
|
||
|
<a name="l00098"></a>00098 <span class="keywordflow">break</span>;
|
||
|
<a name="l00099"></a>00099 }
|
||
|
<a name="l00100"></a>00100 --i;
|
||
|
<a name="l00101"></a>00101 }
|
||
|
<a name="l00102"></a>00102
|
||
|
<a name="l00103"></a>00103 <span class="keywordflow">if</span> ( i>0 )
|
||
|
<a name="l00104"></a>00104 {
|
||
|
<a name="l00105"></a>00105 filename [ i + 1 ] = 0;
|
||
|
<a name="l00106"></a>00106 filename.<a class="code" href="classirr_1_1core_1_1string.html#acf96202ede3fc24bc21d9d0167627224" title="verify the existing string.">validate</a>();
|
||
|
<a name="l00107"></a>00107 }
|
||
|
<a name="l00108"></a>00108 <span class="keywordflow">else</span>
|
||
|
<a name="l00109"></a>00109 filename=<span class="stringliteral">""</span>;
|
||
|
<a name="l00110"></a>00110 <span class="keywordflow">return</span> filename;
|
||
|
<a name="l00111"></a>00111 }
|
||
|
<a name="l00112"></a>00112
|
||
|
<a name="l00115"></a><a class="code" href="namespaceirr_1_1core.html#afc9926e02ab9727cd5998ab2ffa9fa32">00115</a> <span class="keyword">inline</span> <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> <a class="code" href="namespaceirr_1_1core.html#afc9926e02ab9727cd5998ab2ffa9fa32">isInSameDirectory</a> ( <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a>, <span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>& file )
|
||
|
<a name="l00116"></a>00116 {
|
||
|
<a name="l00117"></a>00117 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> subA = 0;
|
||
|
<a name="l00118"></a>00118 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> subB = 0;
|
||
|
<a name="l00119"></a>00119 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> pos;
|
||
|
<a name="l00120"></a>00120
|
||
|
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( path.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a>() && !path.<a class="code" href="classirr_1_1core_1_1string.html#a37c19857c3d44a88ae5a98e5be41b74f" title="compares the first n characters of the strings">equalsn</a> ( file, path.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a>() ) )
|
||
|
<a name="l00122"></a>00122 <span class="keywordflow">return</span> -1;
|
||
|
<a name="l00123"></a>00123
|
||
|
<a name="l00124"></a>00124 pos = 0;
|
||
|
<a name="l00125"></a>00125 <span class="keywordflow">while</span> ( (pos = path.<a class="code" href="classirr_1_1core_1_1string.html#a6d82f74b061b248f01133f34b94841d9" title="finds next occurrence of character in string">findNext</a> ( <span class="charliteral">'/'</span>, pos )) >= 0 )
|
||
|
<a name="l00126"></a>00126 {
|
||
|
<a name="l00127"></a>00127 subA += 1;
|
||
|
<a name="l00128"></a>00128 pos += 1;
|
||
|
<a name="l00129"></a>00129 }
|
||
|
<a name="l00130"></a>00130
|
||
|
<a name="l00131"></a>00131 pos = 0;
|
||
|
<a name="l00132"></a>00132 <span class="keywordflow">while</span> ( (pos = file.<a class="code" href="classirr_1_1core_1_1string.html#a6d82f74b061b248f01133f34b94841d9" title="finds next occurrence of character in string">findNext</a> ( <span class="charliteral">'/'</span>, pos )) >= 0 )
|
||
|
<a name="l00133"></a>00133 {
|
||
|
<a name="l00134"></a>00134 subB += 1;
|
||
|
<a name="l00135"></a>00135 pos += 1;
|
||
|
<a name="l00136"></a>00136 }
|
||
|
<a name="l00137"></a>00137
|
||
|
<a name="l00138"></a>00138 <span class="keywordflow">return</span> subB - subA;
|
||
|
<a name="l00139"></a>00139 }
|
||
|
<a name="l00140"></a>00140
|
||
|
<a name="l00141"></a>00141 <span class="comment">// splits a path into components</span>
|
||
|
<a name="l00142"></a>00142 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> splitFilename(<span class="keyword">const</span> <a class="code" href="classirr_1_1core_1_1string.html">io::path</a> &name, <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>* <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a>=0,
|
||
|
<a name="l00143"></a>00143 <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>* filename=0, <a class="code" href="classirr_1_1core_1_1string.html">io::path</a>* extension=0, <span class="keywordtype">bool</span> make_lower=<span class="keyword">false</span>)
|
||
|
<a name="l00144"></a>00144 {
|
||
|
<a name="l00145"></a>00145 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> i = name.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a>();
|
||
|
<a name="l00146"></a>00146 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> extpos = i;
|
||
|
<a name="l00147"></a>00147
|
||
|
<a name="l00148"></a>00148 <span class="comment">// search for path separator or beginning</span>
|
||
|
<a name="l00149"></a>00149 <span class="keywordflow">while</span> ( i >= 0 )
|
||
|
<a name="l00150"></a>00150 {
|
||
|
<a name="l00151"></a>00151 <span class="keywordflow">if</span> ( name[i] == <span class="charliteral">'.'</span> )
|
||
|
<a name="l00152"></a>00152 {
|
||
|
<a name="l00153"></a>00153 extpos = i;
|
||
|
<a name="l00154"></a>00154 <span class="keywordflow">if</span> ( extension )
|
||
|
<a name="l00155"></a>00155 *extension = name.<a class="code" href="classirr_1_1core_1_1string.html#ad3d16f4aa3c4295f46d86b7bc525450f" title="Returns a substring.">subString</a> ( extpos + 1, name.<a class="code" href="classirr_1_1core_1_1string.html#a062f23675d892012c7e8d5d4e92ecd00" title="Returns length of the string's content.">size</a>() - (extpos + 1), make_lower );
|
||
|
<a name="l00156"></a>00156 }
|
||
|
<a name="l00157"></a>00157 <span class="keywordflow">else</span>
|
||
|
<a name="l00158"></a>00158 <span class="keywordflow">if</span> ( name[i] == <span class="charliteral">'/'</span> || name[i] == <span class="charliteral">'\\'</span> )
|
||
|
<a name="l00159"></a>00159 {
|
||
|
<a name="l00160"></a>00160 <span class="keywordflow">if</span> ( filename )
|
||
|
<a name="l00161"></a>00161 *filename = name.<a class="code" href="classirr_1_1core_1_1string.html#ad3d16f4aa3c4295f46d86b7bc525450f" title="Returns a substring.">subString</a> ( i + 1, extpos - (i + 1), make_lower );
|
||
|
<a name="l00162"></a>00162 <span class="keywordflow">if</span> ( <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> )
|
||
|
<a name="l00163"></a>00163 {
|
||
|
<a name="l00164"></a>00164 *<a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> = name.<a class="code" href="classirr_1_1core_1_1string.html#ad3d16f4aa3c4295f46d86b7bc525450f" title="Returns a substring.">subString</a> ( 0, i + 1, make_lower );
|
||
|
<a name="l00165"></a>00165 <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a>->replace ( <span class="charliteral">'\\'</span>, <span class="charliteral">'/'</span> );
|
||
|
<a name="l00166"></a>00166 }
|
||
|
<a name="l00167"></a>00167 <span class="keywordflow">return</span>;
|
||
|
<a name="l00168"></a>00168 }
|
||
|
<a name="l00169"></a>00169 i -= 1;
|
||
|
<a name="l00170"></a>00170 }
|
||
|
<a name="l00171"></a>00171 <span class="keywordflow">if</span> ( filename )
|
||
|
<a name="l00172"></a>00172 *filename = name.<a class="code" href="classirr_1_1core_1_1string.html#ad3d16f4aa3c4295f46d86b7bc525450f" title="Returns a substring.">subString</a> ( 0, extpos, make_lower );
|
||
|
<a name="l00173"></a>00173 }
|
||
|
<a name="l00174"></a>00174
|
||
|
<a name="l00175"></a>00175
|
||
|
<a name="l00177"></a>00177 <span class="preprocessor">#undef isdigit</span>
|
||
|
<a name="l00178"></a>00178 <span class="preprocessor"></span><span class="preprocessor">#undef isspace</span>
|
||
|
<a name="l00179"></a>00179 <span class="preprocessor"></span><span class="preprocessor">#undef isupper</span>
|
||
|
<a name="l00180"></a><a class="code" href="namespaceirr_1_1core.html#ac7f1fc1c7eb3f8291b8a044214823070">00180</a> <span class="preprocessor"></span><span class="keyword">inline</span> <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> <a class="code" href="namespaceirr_1_1core.html#ac7f1fc1c7eb3f8291b8a044214823070" title="some standard function ( to remove dependencies )">isdigit</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> c) { <span class="keywordflow">return</span> c >= <span class="charliteral">'0'</span> && c <= <span class="charliteral">'9'</span>; }
|
||
|
<a name="l00181"></a><a class="code" href="namespaceirr_1_1core.html#aca7b6fe1985b526a8519885bbbd670bb">00181</a> <span class="keyword">inline</span> <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> <a class="code" href="namespaceirr_1_1core.html#aca7b6fe1985b526a8519885bbbd670bb">isspace</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> c) { <span class="keywordflow">return</span> c == <span class="charliteral">' '</span> || c == <span class="charliteral">'\f'</span> || c == <span class="charliteral">'\n'</span> || c == <span class="charliteral">'\r'</span> || c == <span class="charliteral">'\t'</span> || c == <span class="charliteral">'\v'</span>; }
|
||
|
<a name="l00182"></a><a class="code" href="namespaceirr_1_1core.html#a5d1328379d825a783e8ac832480701b7">00182</a> <span class="keyword">inline</span> <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> <a class="code" href="namespaceirr_1_1core.html#a5d1328379d825a783e8ac832480701b7">isupper</a>(<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> c) { <span class="keywordflow">return</span> c >= <span class="charliteral">'A'</span> && c <= <span class="charliteral">'Z'</span>; }
|
||
|
<a name="l00183"></a>00183
|
||
|
<a name="l00184"></a>00184
|
||
|
<a name="l00185"></a>00185 } <span class="comment">// end namespace core</span>
|
||
|
<a name="l00186"></a>00186 } <span class="comment">// end namespace irr</span>
|
||
|
<a name="l00187"></a>00187
|
||
|
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
|
||
|
</pre></div></div>
|
||
|
</div>
|
||
|
<div id="nav-path" class="navpath">
|
||
|
<ul>
|
||
|
<li class="navelem"><a class="el" href="coreutil_8h.html">coreutil.h</a> </li>
|
||
|
<!-- window showing the filter options -->
|
||
|
<div id="MSearchSelectWindow"
|
||
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Defines</a></div>
|
||
|
|
||
|
<!-- iframe showing the search results (closed by default) -->
|
||
|
<div id="MSearchResultsWindow">
|
||
|
<iframe src="javascript:void(0)" frameborder="0"
|
||
|
name="MSearchResults" id="MSearchResults">
|
||
|
</iframe>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<li class="footer">
|
||
|
<a href="http://irrlicht.sourceforge.net" target="_blank">Irrlicht
|
||
|
Engine</a> Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on Sat Jul 9 2016 18:18:17 for Irrlicht 3D Engine by
|
||
|
<a href="http://www.doxygen.org/index.html" target="_blank">Doxygen</a> 1.7.5.1 </li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|