MCPcopy Create free account
hub / github.com/cinder/Cinder / parse_pi

Method parse_pi

include/rapidxml/rapidxml.hpp:1880–1934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1878 // Parse PI
1879 template<int Flags>
1880 xml_node<Ch> *parse_pi(Ch *&text)
1881 {
1882 // If creation of PI nodes is enabled
1883 if (Flags & parse_pi_nodes)
1884 {
1885 // Create pi node
1886 xml_node<Ch> *pi = this->allocate_node(node_pi);
1887
1888 // Extract PI target name
1889 Ch *name = text;
1890 skip<node_name_pred, Flags>(text);
1891 if (text == name)
1892 RAPIDXML_PARSE_ERROR("expected PI target", text);
1893 pi->name(name, text - name);
1894
1895 // Skip whitespace between pi target and pi
1896 skip<whitespace_pred, Flags>(text);
1897
1898 // Remember start of pi
1899 Ch *value = text;
1900
1901 // Skip to '?>'
1902 while (text[0] != Ch('?') || text[1] != Ch('>'))
1903 {
1904 if (*text == Ch('\0'))
1905 RAPIDXML_PARSE_ERROR("unexpected end of data", text);
1906 ++text;
1907 }
1908
1909 // Set pi value (verbatim, no entity expansion or whitespace normalization)
1910 pi->value(value, text - value);
1911
1912 // Place zero terminator after name and value
1913 if (!(Flags & parse_no_string_terminators))
1914 {
1915 pi->name()[pi->name_size()] = Ch('\0');
1916 pi->value()[pi->value_size()] = Ch('\0');
1917 }
1918
1919 text += 2; // Skip '?>'
1920 return pi;
1921 }
1922 else
1923 {
1924 // Skip to '?>'
1925 while (text[0] != Ch('?') || text[1] != Ch('>'))
1926 {
1927 if (*text == Ch('\0'))
1928 RAPIDXML_PARSE_ERROR("unexpected end of data", text);
1929 ++text;
1930 }
1931 text += 2; // Skip '?>'
1932 return 0;
1933 }
1934 }
1935
1936 // Parse and append data
1937 // Return character that ends data.

Callers

nothing calls this directly

Calls 5

allocate_nodeMethod · 0.80
name_sizeMethod · 0.80
value_sizeMethod · 0.80
nameMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected