| 1945 | |
| 1946 | |
| 1947 | void XMLPrinter::PrintString( const char* p, bool restricted ) |
| 1948 | { |
| 1949 | // Look for runs of bytes between entities to print. |
| 1950 | const char* q = p; |
| 1951 | const bool* flag = restricted ? _restrictedEntityFlag : _entityFlag; |
| 1952 | |
| 1953 | if ( _processEntities ) { |
| 1954 | while ( *q ) { |
| 1955 | // Remember, char is sometimes signed. (How many times has that bitten me?) |
| 1956 | if ( *q > 0 && *q < ENTITY_RANGE ) { |
| 1957 | // Check for entities. If one is found, flush |
| 1958 | // the stream up until the entity, write the |
| 1959 | // entity, and keep looking. |
| 1960 | if ( flag[(unsigned)(*q)] ) { |
| 1961 | while ( p < q ) { |
| 1962 | Print( "%c", *p ); |
| 1963 | ++p; |
| 1964 | } |
| 1965 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 1966 | if ( entities[i].value == *q ) { |
| 1967 | Print( "&%s;", entities[i].pattern ); |
| 1968 | break; |
| 1969 | } |
| 1970 | } |
| 1971 | ++p; |
| 1972 | } |
| 1973 | } |
| 1974 | ++q; |
| 1975 | } |
| 1976 | } |
| 1977 | // Flush the remaining string. This will be the entire |
| 1978 | // string if an entity wasn't found. |
| 1979 | if ( !_processEntities || (q-p > 0) ) { |
| 1980 | Print( "%s", p ); |
| 1981 | } |
| 1982 | } |
| 1983 | |
| 1984 | |
| 1985 | void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) |
nothing calls this directly
no outgoing calls
no test coverage detected