| 56 | |
| 57 | template<typename Device> |
| 58 | inline bool put(Device& dev, char ch) |
| 59 | { |
| 60 | switch (state) { |
| 61 | case 0: |
| 62 | case 1: |
| 63 | if (ch == ']') { |
| 64 | ++state; |
| 65 | } |
| 66 | else { |
| 67 | state = 0; |
| 68 | } |
| 69 | break; |
| 70 | case 2: |
| 71 | if (ch == '>') { |
| 72 | static const char escape[] = "]]><![CDATA["; |
| 73 | boost::iostreams::write(dev, escape, sizeof(escape) - 1); |
| 74 | } |
| 75 | state = 0; |
| 76 | break; |
| 77 | } |
| 78 | return boost::iostreams::put(dev, ch); |
| 79 | } |
| 80 | |
| 81 | int state = 0; |
| 82 | }; |
no test coverage detected