| 1891 | |
| 1892 | |
| 1893 | void XMLPrinter::PrintString( const char* p, bool restricted ) { |
| 1894 | // Look for runs of bytes between entities to print. |
| 1895 | const char* q = p; |
| 1896 | |
| 1897 | if ( _processEntities ) { |
| 1898 | const bool* flag = restricted ? _restrictedEntityFlag : _entityFlag; |
| 1899 | while ( *q ) { |
| 1900 | // Remember, char is sometimes signed. (How many times has that bitten me?) |
| 1901 | if ( *q > 0 && *q < ENTITY_RANGE ) { |
| 1902 | // Check for entities. If one is found, flush |
| 1903 | // the stream up until the entity, write the |
| 1904 | // entity, and keep looking. |
| 1905 | if ( flag[(unsigned char)(*q)] ) { |
| 1906 | while ( p < q ) { |
| 1907 | Print( "%c", *p ); |
| 1908 | ++p; |
| 1909 | } |
| 1910 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 1911 | if ( entities[i].value == *q ) { |
| 1912 | Print( "&%s;", entities[i].pattern ); |
| 1913 | break; |
| 1914 | } |
| 1915 | } |
| 1916 | ++p; |
| 1917 | } |
| 1918 | } |
| 1919 | ++q; |
| 1920 | } |
| 1921 | } |
| 1922 | // Flush the remaining string. This will be the entire |
| 1923 | // string if an entity wasn't found. |
| 1924 | if ( !_processEntities || (q-p > 0) ) { |
| 1925 | Print( "%s", p ); |
| 1926 | } |
| 1927 | } |
| 1928 | |
| 1929 | |
| 1930 | void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) { |
nothing calls this directly
no outgoing calls
no test coverage detected