/usr/share/doc/libid3-doc/api/field__string__unicode_8cpp_source.html is in libid3-doc 3.8.3-14.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | <!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>id3lib: src/field_string_unicode.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="id3lib.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">id3lib <span id="projectnumber">3.8.3</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">src/field_string_unicode.cpp</div> </div>
</div>
<div class="contents">
<a href="field__string__unicode_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// $Id: field_string_unicode.cpp,v 1.33 2003/03/02 14:23:58 t1mpy Exp $</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="comment">// id3lib: a C++ library for creating and manipulating id3v1/v2 tags</span>
<a name="l00004"></a>00004 <span class="comment">// Copyright 1999, 2000 Scott Thomas Haug</span>
<a name="l00005"></a>00005
<a name="l00006"></a>00006 <span class="comment">// This library is free software; you can redistribute it and/or modify it</span>
<a name="l00007"></a>00007 <span class="comment">// under the terms of the GNU Library General Public License as published by</span>
<a name="l00008"></a>00008 <span class="comment">// the Free Software Foundation; either version 2 of the License, or (at your</span>
<a name="l00009"></a>00009 <span class="comment">// option) any later version.</span>
<a name="l00010"></a>00010 <span class="comment">//</span>
<a name="l00011"></a>00011 <span class="comment">// This library is distributed in the hope that it will be useful, but WITHOUT</span>
<a name="l00012"></a>00012 <span class="comment">// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span>
<a name="l00013"></a>00013 <span class="comment">// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public</span>
<a name="l00014"></a>00014 <span class="comment">// License for more details.</span>
<a name="l00015"></a>00015 <span class="comment">//</span>
<a name="l00016"></a>00016 <span class="comment">// You should have received a copy of the GNU Library General Public License</span>
<a name="l00017"></a>00017 <span class="comment">// along with this library; if not, write to the Free Software Foundation,</span>
<a name="l00018"></a>00018 <span class="comment">// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</span>
<a name="l00019"></a>00019
<a name="l00020"></a>00020 <span class="comment">// The id3lib authors encourage improvements and optimisations to be sent to</span>
<a name="l00021"></a>00021 <span class="comment">// the id3lib coordinator. Please see the README file for details on where to</span>
<a name="l00022"></a>00022 <span class="comment">// send such submissions. See the AUTHORS file for a list of people who have</span>
<a name="l00023"></a>00023 <span class="comment">// contributed to id3lib. See the ChangeLog file for a list of changes to</span>
<a name="l00024"></a>00024 <span class="comment">// id3lib. These files are distributed with id3lib at</span>
<a name="l00025"></a>00025 <span class="comment">// http://download.sourceforge.net/id3lib/</span>
<a name="l00026"></a>00026
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="field__impl_8h.html">field_impl.h</a>"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include "id3/utils.h"</span> <span class="comment">// has <config.h> "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h"</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include "io_helpers.h"</span>
<a name="l00030"></a>00030
<a name="l00031"></a>00031 <span class="keyword">using namespace </span>dami;
<a name="l00032"></a>00032
<a name="l00049"></a><a class="code" href="class_i_d3___field_impl.html#a5e4ebdb241a1dde45d7b1f17ed4b7b99">00049</a> <span class="keywordtype">size_t</span> <a class="code" href="class_i_d3___field_impl.html#a6daa86b940122734d9bee75d7b57d6cf" title="Sets the value of the field to the specified integer.">ID3_FieldImpl::Set</a>(<span class="keyword">const</span> <a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a>* data)
<a name="l00050"></a>00050 {
<a name="l00051"></a>00051 <span class="keywordtype">size_t</span> size = 0;
<a name="l00052"></a>00052 <span class="keywordflow">if</span> (this->GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba2ee1dd56f8581f7c930d8ae610d9fb55">ID3FTY_TEXTSTRING</a> &&
<a name="l00053"></a>00053 this->GetEncoding() == <a class="code" href="globals_8h.html#a2a414b8e1666bd6dd8dce86cdcf74a39ac5345a1533e33f6d71840f30e83e0d02">ID3TE_UNICODE</a> && data)
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 String text((<span class="keyword">const</span> <span class="keywordtype">char</span>*) data, ucslen(data) * 2);
<a name="l00056"></a>00056 size = this->SetText_i(text);
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058 <span class="keywordflow">return</span> size;
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060
<a name="l00061"></a><a class="code" href="class_i_d3___field_impl.html#a46406170d406d52ad395817fd483a50d">00061</a> <span class="keywordtype">size_t</span> <a class="code" href="class_i_d3___field_impl.html#a0493b19b836899394d02839bd14d1e28">ID3_FieldImpl::Add</a>(<span class="keyword">const</span> <a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a>* data)
<a name="l00062"></a>00062 {
<a name="l00063"></a>00063 <span class="keywordtype">size_t</span> size = 0;
<a name="l00064"></a>00064 <span class="keywordflow">if</span> (this->GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba2ee1dd56f8581f7c930d8ae610d9fb55">ID3FTY_TEXTSTRING</a> &&
<a name="l00065"></a>00065 this->GetEncoding() == <a class="code" href="globals_8h.html#a2a414b8e1666bd6dd8dce86cdcf74a39ac5345a1533e33f6d71840f30e83e0d02">ID3TE_UNICODE</a>)
<a name="l00066"></a>00066 {
<a name="l00067"></a>00067 String text((<span class="keyword">const</span> <span class="keywordtype">char</span>*) data, ucslen(data) * 2);
<a name="l00068"></a>00068 size = this->AddText_i(text);
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070 <span class="keywordflow">return</span> size;
<a name="l00071"></a>00071 }
<a name="l00072"></a>00072
<a name="l00093"></a><a class="code" href="class_i_d3___field_impl.html#a0b39bf7b3c161471b3ac94b6eec90014">00093</a> <span class="keywordtype">size_t</span> <a class="code" href="class_i_d3___field_impl.html#ab0e321c609325a38f29bc279bfb7b2be" title="Returns the value of the integer field.">ID3_FieldImpl::Get</a>(<a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a> *buffer, <span class="keywordtype">size_t</span> maxLength)<span class="keyword"> const</span>
<a name="l00094"></a>00094 <span class="keyword"></span>{
<a name="l00095"></a>00095 <span class="keywordtype">size_t</span> length = 0;
<a name="l00096"></a>00096 <span class="keywordflow">if</span> (this->GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba2ee1dd56f8581f7c930d8ae610d9fb55">ID3FTY_TEXTSTRING</a> &&
<a name="l00097"></a>00097 this->GetEncoding() == <a class="code" href="globals_8h.html#a2a414b8e1666bd6dd8dce86cdcf74a39ac5345a1533e33f6d71840f30e83e0d02">ID3TE_UNICODE</a> &&
<a name="l00098"></a>00098 buffer != <a class="code" href="globals_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> && maxLength > 0)
<a name="l00099"></a>00099 {
<a name="l00100"></a>00100 <span class="keywordtype">size_t</span> size = this-><a class="code" href="class_i_d3___frame_impl.html#a2372f07a4f1b05b144ea4a797e679e88">Size</a>();
<a name="l00101"></a>00101 length = dami::min(maxLength, size);
<a name="l00102"></a>00102 ::memcpy((<span class="keywordtype">void</span> *)buffer, (<span class="keywordtype">void</span> *)_text.data(), length * 2);
<a name="l00103"></a>00103 <span class="keywordflow">if</span> (length < maxLength)
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105 buffer[length] = <a class="code" href="globals_8h.html#adf2f9dc565f7cb248d7baf38c543376f">NULL_UNICODE</a>;
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 <span class="keywordflow">return</span> length;
<a name="l00109"></a>00109 }
<a name="l00110"></a>00110
<a name="l00111"></a><a class="code" href="class_i_d3___field_impl.html#ab8c9fd2ac15148731126895883532167">00111</a> <span class="keyword">const</span> <a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a>* <a class="code" href="class_i_d3___field_impl.html#ab8c9fd2ac15148731126895883532167">ID3_FieldImpl::GetRawUnicodeText</a>()<span class="keyword"> const</span>
<a name="l00112"></a>00112 <span class="keyword"></span>{
<a name="l00113"></a>00113 <span class="keyword">const</span> <a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a>* text = <a class="code" href="globals_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00114"></a>00114 <span class="keywordflow">if</span> (this->GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba2ee1dd56f8581f7c930d8ae610d9fb55">ID3FTY_TEXTSTRING</a> &&
<a name="l00115"></a>00115 this->GetEncoding() == <a class="code" href="globals_8h.html#a2a414b8e1666bd6dd8dce86cdcf74a39ac5345a1533e33f6d71840f30e83e0d02">ID3TE_UNICODE</a>)
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117 text = (<a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a> *)_text.data();
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119 <span class="keywordflow">return</span> text;
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121
<a name="l00122"></a><a class="code" href="class_i_d3___field_impl.html#a0b749211804be718ea62a216492944e6">00122</a> <span class="keyword">const</span> <a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a>* <a class="code" href="class_i_d3___field_impl.html#a0b749211804be718ea62a216492944e6">ID3_FieldImpl::GetRawUnicodeTextItem</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span>
<a name="l00123"></a>00123 <span class="keyword"></span>{
<a name="l00124"></a>00124 <span class="keyword">const</span> <a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a>* text = <a class="code" href="globals_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00125"></a>00125 <span class="keywordflow">if</span> (this->GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba2ee1dd56f8581f7c930d8ae610d9fb55">ID3FTY_TEXTSTRING</a> &&
<a name="l00126"></a>00126 this->GetEncoding() == <a class="code" href="globals_8h.html#a2a414b8e1666bd6dd8dce86cdcf74a39ac5345a1533e33f6d71840f30e83e0d02">ID3TE_UNICODE</a> &&
<a name="l00127"></a>00127 index < this->GetNumTextItems())
<a name="l00128"></a>00128 {
<a name="l00129"></a>00129 String unicode = _text + <span class="charliteral">'\0'</span> + <span class="charliteral">'\0'</span>;
<a name="l00130"></a>00130 text = (<a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a> *) unicode.data();
<a name="l00131"></a>00131 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < index; ++i)
<a name="l00132"></a>00132 {
<a name="l00133"></a>00133 text += ucslen(text) + 1;
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 }
<a name="l00136"></a>00136 <span class="keywordflow">return</span> text;
<a name="l00137"></a>00137 }
<a name="l00138"></a>00138
<a name="l00139"></a><a class="code" href="class_i_d3___field_impl.html#abddb3eb765d1659d58484606a66f938f">00139</a> <span class="keywordtype">size_t</span> <a class="code" href="class_i_d3___field_impl.html#ab0e321c609325a38f29bc279bfb7b2be" title="Returns the value of the integer field.">ID3_FieldImpl::Get</a>(<a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a> *buffer, <span class="keywordtype">size_t</span> maxLength, <span class="keywordtype">size_t</span> itemNum)<span class="keyword"> const</span>
<a name="l00140"></a>00140 <span class="keyword"></span>{
<a name="l00141"></a>00141 <span class="keywordtype">size_t</span> length = 0;
<a name="l00142"></a>00142 <span class="keywordtype">size_t</span> total_items = this->GetNumTextItems();
<a name="l00143"></a>00143 <span class="keywordflow">if</span> (this->GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba2ee1dd56f8581f7c930d8ae610d9fb55">ID3FTY_TEXTSTRING</a> &&
<a name="l00144"></a>00144 this->GetEncoding() == <a class="code" href="globals_8h.html#a2a414b8e1666bd6dd8dce86cdcf74a39ac5345a1533e33f6d71840f30e83e0d02">ID3TE_UNICODE</a> &&
<a name="l00145"></a>00145 buffer != <a class="code" href="globals_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> && maxLength > 0 && itemNum < total_items)
<a name="l00146"></a>00146 {
<a name="l00147"></a>00147 <span class="keyword">const</span> <a class="code" href="globals_8h.html#a781c2cce7ea2af8192d5f83427044add">unicode_t</a>* text = this->GetRawUnicodeTextItem(itemNum);
<a name="l00148"></a>00148 <span class="keywordflow">if</span> (<a class="code" href="globals_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> != text)
<a name="l00149"></a>00149 {
<a name="l00150"></a>00150 <span class="keywordtype">size_t</span> length = dami::min(maxLength, ucslen(text));
<a name="l00151"></a>00151 ::memcpy(buffer, text, length * 2);
<a name="l00152"></a>00152 <span class="keywordflow">if</span> (length < maxLength)
<a name="l00153"></a>00153 {
<a name="l00154"></a>00154 buffer[length] = <a class="code" href="globals_8h.html#adf2f9dc565f7cb248d7baf38c543376f">NULL_UNICODE</a>;
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 }
<a name="l00158"></a>00158
<a name="l00159"></a>00159 <span class="keywordflow">return</span> length;
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161
<a name="l00162"></a>00162
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Tue Oct 18 2011 17:40:15 for id3lib by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
|