| <?xml version='1.0' encoding='UTF-8' standalone='no'?> |
| <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.8" xml:lang="en-US"> |
| <compounddef id="string__util_8cc" kind="file" language="C++"> |
| <compoundname>string_util.cc</compoundname> |
| <includes refid="string__util_8h" local="yes">iceberg/util/string_util.h</includes> |
| <includes refid="macros_8h" local="yes">iceberg/util/macros.h</includes> |
| <incdepgraph> |
| <node id="19"> |
| <label>iceberg/exception.h</label> |
| <link refid="exception_8h"/> |
| <childnode refid="20" relation="include"> |
| </childnode> |
| <childnode refid="13" relation="include"> |
| </childnode> |
| </node> |
| <node id="13"> |
| <label>iceberg/iceberg_export.h</label> |
| <link refid="iceberg__export_8h_source"/> |
| </node> |
| <node id="14"> |
| <label>iceberg/result.h</label> |
| <link refid="result_8h_source"/> |
| <childnode refid="15" relation="include"> |
| </childnode> |
| <childnode refid="16" relation="include"> |
| </childnode> |
| <childnode refid="7" relation="include"> |
| </childnode> |
| <childnode refid="13" relation="include"> |
| </childnode> |
| </node> |
| <node id="17"> |
| <label>iceberg/util/macros.h</label> |
| <link refid="macros_8h_source"/> |
| <childnode refid="18" relation="include"> |
| </childnode> |
| <childnode refid="19" relation="include"> |
| </childnode> |
| <childnode refid="14" relation="include"> |
| </childnode> |
| </node> |
| <node id="1"> |
| <label>iceberg/util/string_util.cc</label> |
| <link refid="string__util_8cc"/> |
| <childnode refid="2" relation="include"> |
| </childnode> |
| <childnode refid="17" relation="include"> |
| </childnode> |
| </node> |
| <node id="2"> |
| <label>iceberg/util/string_util.h</label> |
| <link refid="string__util_8h_source"/> |
| <childnode refid="3" relation="include"> |
| </childnode> |
| <childnode refid="4" relation="include"> |
| </childnode> |
| <childnode refid="5" relation="include"> |
| </childnode> |
| <childnode refid="6" relation="include"> |
| </childnode> |
| <childnode refid="7" relation="include"> |
| </childnode> |
| <childnode refid="8" relation="include"> |
| </childnode> |
| <childnode refid="9" relation="include"> |
| </childnode> |
| <childnode refid="10" relation="include"> |
| </childnode> |
| <childnode refid="11" relation="include"> |
| </childnode> |
| <childnode refid="12" relation="include"> |
| </childnode> |
| <childnode refid="13" relation="include"> |
| </childnode> |
| <childnode refid="14" relation="include"> |
| </childnode> |
| </node> |
| <node id="3"> |
| <label>algorithm</label> |
| </node> |
| <node id="18"> |
| <label>cassert</label> |
| </node> |
| <node id="4"> |
| <label>cerrno</label> |
| </node> |
| <node id="5"> |
| <label>charconv</label> |
| </node> |
| <node id="15"> |
| <label>expected</label> |
| </node> |
| <node id="16"> |
| <label>format</label> |
| </node> |
| <node id="6"> |
| <label>ranges</label> |
| </node> |
| <node id="20"> |
| <label>stdexcept</label> |
| </node> |
| <node id="7"> |
| <label>string</label> |
| </node> |
| <node id="8"> |
| <label>string_view</label> |
| </node> |
| <node id="9"> |
| <label>type_traits</label> |
| </node> |
| <node id="10"> |
| <label>typeinfo</label> |
| </node> |
| <node id="11"> |
| <label>utility</label> |
| </node> |
| <node id="12"> |
| <label>vector</label> |
| </node> |
| </incdepgraph> |
| <innernamespace refid="namespaceiceberg">iceberg</innernamespace> |
| <briefdescription> |
| </briefdescription> |
| <detaileddescription> |
| </detaileddescription> |
| <programlisting> |
| <codeline lineno="1"><highlight class="comment">/*</highlight></codeline> |
| <codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Licensed<sp/>to<sp/>the<sp/>Apache<sp/>Software<sp/>Foundation<sp/>(ASF)<sp/>under<sp/>one</highlight></codeline> |
| <codeline lineno="3"><highlight class="comment"><sp/>*<sp/>or<sp/>more<sp/>contributor<sp/>license<sp/>agreements.<sp/><sp/>See<sp/>the<sp/>NOTICE<sp/>file</highlight></codeline> |
| <codeline lineno="4"><highlight class="comment"><sp/>*<sp/>distributed<sp/>with<sp/>this<sp/>work<sp/>for<sp/>additional<sp/>information</highlight></codeline> |
| <codeline lineno="5"><highlight class="comment"><sp/>*<sp/>regarding<sp/>copyright<sp/>ownership.<sp/><sp/>The<sp/>ASF<sp/>licenses<sp/>this<sp/>file</highlight></codeline> |
| <codeline lineno="6"><highlight class="comment"><sp/>*<sp/>to<sp/>you<sp/>under<sp/>the<sp/>Apache<sp/>License,<sp/>Version<sp/>2.0<sp/>(the</highlight></codeline> |
| <codeline lineno="7"><highlight class="comment"><sp/>*<sp/>"License");<sp/>you<sp/>may<sp/>not<sp/>use<sp/>this<sp/>file<sp/>except<sp/>in<sp/>compliance</highlight></codeline> |
| <codeline lineno="8"><highlight class="comment"><sp/>*<sp/>with<sp/>the<sp/>License.<sp/><sp/>You<sp/>may<sp/>obtain<sp/>a<sp/>copy<sp/>of<sp/>the<sp/>License<sp/>at</highlight></codeline> |
| <codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline> |
| <codeline lineno="10"><highlight class="comment"><sp/>*<sp/><sp/><sp/>http://www.apache.org/licenses/LICENSE-2.0</highlight></codeline> |
| <codeline lineno="11"><highlight class="comment"><sp/>*</highlight></codeline> |
| <codeline lineno="12"><highlight class="comment"><sp/>*<sp/>Unless<sp/>required<sp/>by<sp/>applicable<sp/>law<sp/>or<sp/>agreed<sp/>to<sp/>in<sp/>writing,</highlight></codeline> |
| <codeline lineno="13"><highlight class="comment"><sp/>*<sp/>software<sp/>distributed<sp/>under<sp/>the<sp/>License<sp/>is<sp/>distributed<sp/>on<sp/>an</highlight></codeline> |
| <codeline lineno="14"><highlight class="comment"><sp/>*<sp/>"AS<sp/>IS"<sp/>BASIS,<sp/>WITHOUT<sp/>WARRANTIES<sp/>OR<sp/>CONDITIONS<sp/>OF<sp/>ANY</highlight></codeline> |
| <codeline lineno="15"><highlight class="comment"><sp/>*<sp/>KIND,<sp/>either<sp/>express<sp/>or<sp/>implied.<sp/><sp/>See<sp/>the<sp/>License<sp/>for<sp/>the</highlight></codeline> |
| <codeline lineno="16"><highlight class="comment"><sp/>*<sp/>specific<sp/>language<sp/>governing<sp/>permissions<sp/>and<sp/>limitations</highlight></codeline> |
| <codeline lineno="17"><highlight class="comment"><sp/>*<sp/>under<sp/>the<sp/>License.</highlight></codeline> |
| <codeline lineno="18"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline> |
| <codeline lineno="19"><highlight class="normal"></highlight></codeline> |
| <codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"iceberg/util/string_util.h"</highlight><highlight class="normal"></highlight></codeline> |
| <codeline lineno="21"><highlight class="normal"></highlight></codeline> |
| <codeline lineno="22"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"iceberg/util/macros.h"</highlight><highlight class="normal"></highlight></codeline> |
| <codeline lineno="23"><highlight class="normal"></highlight></codeline> |
| <codeline lineno="24"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">iceberg<sp/>{</highlight></codeline> |
| <codeline lineno="25"><highlight class="normal"></highlight></codeline> |
| <codeline lineno="26"><highlight class="normal">Result<std::vector<uint8_t>><sp/><ref refid="classiceberg_1_1StringUtils_1a78de1e915228a46eaa3c814f20764c26" kindref="member">StringUtils::HexStringToBytes</ref>(std::string_view<sp/>hex)<sp/>{</highlight></codeline> |
| <codeline lineno="27"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(hex.size()<sp/>%<sp/>2<sp/>!=<sp/>0)<sp/>[[unlikely]]<sp/>{</highlight></codeline> |
| <codeline lineno="28"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>InvalidArgument(</highlight><highlight class="stringliteral">"Hex<sp/>string<sp/>must<sp/>have<sp/>even<sp/>length,<sp/>got:<sp/>{}"</highlight><highlight class="normal">,<sp/>hex.size());</highlight></codeline> |
| <codeline lineno="29"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
| <codeline lineno="30"><highlight class="normal"><sp/><sp/>std::vector<uint8_t><sp/>bytes;</highlight></codeline> |
| <codeline lineno="31"><highlight class="normal"><sp/><sp/>bytes.reserve(hex.size()<sp/>/<sp/>2);</highlight></codeline> |
| <codeline lineno="32"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">auto</highlight><highlight class="normal"><sp/>nibble<sp/>=<sp/>[](</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>c)<sp/>-><sp/>Result<uint8_t><sp/>{</highlight></codeline> |
| <codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>>=<sp/></highlight><highlight class="charliteral">'0'</highlight><highlight class="normal"><sp/>&&<sp/>c<sp/><=<sp/></highlight><highlight class="charliteral">'9'</highlight><highlight class="normal">)<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static_cast<</highlight><highlight class="normal">uint8_t</highlight><highlight class="keyword">></highlight><highlight class="normal">(c<sp/>-<sp/></highlight><highlight class="charliteral">'0'</highlight><highlight class="normal">);</highlight></codeline> |
| <codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>>=<sp/></highlight><highlight class="charliteral">'a'</highlight><highlight class="normal"><sp/>&&<sp/>c<sp/><=<sp/></highlight><highlight class="charliteral">'f'</highlight><highlight class="normal">)<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static_cast<</highlight><highlight class="normal">uint8_t</highlight><highlight class="keyword">></highlight><highlight class="normal">(c<sp/>-<sp/></highlight><highlight class="charliteral">'a'</highlight><highlight class="normal"><sp/>+<sp/>10);</highlight></codeline> |
| <codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>>=<sp/></highlight><highlight class="charliteral">'A'</highlight><highlight class="normal"><sp/>&&<sp/>c<sp/><=<sp/></highlight><highlight class="charliteral">'F'</highlight><highlight class="normal">)<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static_cast<</highlight><highlight class="normal">uint8_t</highlight><highlight class="keyword">></highlight><highlight class="normal">(c<sp/>-<sp/></highlight><highlight class="charliteral">'A'</highlight><highlight class="normal"><sp/>+<sp/>10);</highlight></codeline> |
| <codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>InvalidArgument(</highlight><highlight class="stringliteral">"Invalid<sp/>hex<sp/>character:<sp/>'{}'"</highlight><highlight class="normal">,<sp/>c);</highlight></codeline> |
| <codeline lineno="37"><highlight class="normal"><sp/><sp/>};</highlight></codeline> |
| <codeline lineno="38"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>hex.size();<sp/>i<sp/>+=<sp/>2)<sp/>{</highlight></codeline> |
| <codeline lineno="39"><highlight class="normal"><sp/><sp/><sp/><sp/>ICEBERG_ASSIGN_OR_RAISE(</highlight><highlight class="keyword">auto</highlight><highlight class="normal"><sp/>hi,<sp/>nibble(hex[i]));</highlight></codeline> |
| <codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/>ICEBERG_ASSIGN_OR_RAISE(</highlight><highlight class="keyword">auto</highlight><highlight class="normal"><sp/>lo,<sp/>nibble(hex[i<sp/>+<sp/>1]));</highlight></codeline> |
| <codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/>bytes.push_back(</highlight><highlight class="keyword">static_cast<</highlight><highlight class="normal">uint8_t</highlight><highlight class="keyword">></highlight><highlight class="normal">((hi<sp/><<<sp/>4)<sp/>|<sp/>lo));</highlight></codeline> |
| <codeline lineno="42"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
| <codeline lineno="43"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>bytes;</highlight></codeline> |
| <codeline lineno="44"><highlight class="normal">}</highlight></codeline> |
| <codeline lineno="45"><highlight class="normal"></highlight></codeline> |
| <codeline lineno="46"><highlight class="normal">}<sp/><sp/></highlight><highlight class="comment">//<sp/>namespace<sp/>iceberg</highlight><highlight class="normal"></highlight></codeline> |
| </programlisting> |
| <location file="iceberg/util/string_util.cc"/> |
| </compounddef> |
| </doxygen> |