Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(237)

Side by Side Diff: src/xml/SkDOM.cpp

Issue 96099: Whitespace fix: remove whitespace from the end of lines.
Patch Set: Created 16 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/xml/SkBML_XMLParser.cpp ('k') | src/xml/SkJS.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* libs/graphics/xml/SkDOM.cpp 1 /* libs/graphics/xml/SkDOM.cpp
2 ** 2 **
3 ** Copyright 2006, The Android Open Source Project 3 ** Copyright 2006, The Android Open Source Project
4 ** 4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License. 6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at 7 ** You may obtain a copy of the License at
8 ** 8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** http://www.apache.org/licenses/LICENSE-2.0
10 ** 10 **
11 ** Unless required by applicable law or agreed to in writing, software 11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS, 12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and 14 ** See the License for the specific language governing permissions and
15 ** limitations under the License. 15 ** limitations under the License.
16 */ 16 */
17 17
18 #include "SkDOM.h" 18 #include "SkDOM.h"
19 19
20 ///////////////////////////////////////////////////////////////////////// 20 /////////////////////////////////////////////////////////////////////////
21 21
22 #include "SkXMLParser.h" 22 #include "SkXMLParser.h"
23 23
24 bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node) 24 bool SkXMLParser::parse(const SkDOM& dom, const SkDOMNode* node)
25 { 25 {
26 const char* elemName = dom.getName(node); 26 const char* elemName = dom.getName(node);
27 27
28 if (this->startElement(elemName)) 28 if (this->startElement(elemName))
29 return false; 29 return false;
30 30
31 SkDOM::AttrIter iter(dom, node); 31 SkDOM::AttrIter iter(dom, node);
32 const char* name, *value; 32 const char* name, *value;
33 33
34 while ((name = iter.next(&value)) != NULL) 34 while ((name = iter.next(&value)) != NULL)
35 if (this->addAttribute(name, value)) 35 if (this->addAttribute(name, value))
36 return false; 36 return false;
37 37
38 if ((node = dom.getFirstChild(node)) != NULL) 38 if ((node = dom.getFirstChild(node)) != NULL)
39 do { 39 do {
40 if (!this->parse(dom, node)) 40 if (!this->parse(dom, node))
41 return false; 41 return false;
42 } while ((node = dom.getNextSibling(node)) != NULL); 42 } while ((node = dom.getNextSibling(node)) != NULL);
43 43
44 return !this->endElement(elemName); 44 return !this->endElement(elemName);
45 } 45 }
46 46
47 ///////////////////////////////////////////////////////////////////////// 47 /////////////////////////////////////////////////////////////////////////
48 48
49 struct SkDOMAttr { 49 struct SkDOMAttr {
50 const char* fName; 50 const char* fName;
51 const char* fValue; 51 const char* fValue;
52 }; 52 };
53 53
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 return fRoot; 313 return fRoot;
314 } 314 }
315 315
316 /////////////////////////////////////////////////////////////////////////// 316 ///////////////////////////////////////////////////////////////////////////
317 317
318 static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* par ser) 318 static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* par ser)
319 { 319 {
320 const char* elem = dom.getName(node); 320 const char* elem = dom.getName(node);
321 321
322 parser->startElement(elem); 322 parser->startElement(elem);
323 323
324 SkDOM::AttrIter iter(dom, node); 324 SkDOM::AttrIter iter(dom, node);
325 const char* name; 325 const char* name;
326 const char* value; 326 const char* value;
327 while ((name = iter.next(&value)) != NULL) 327 while ((name = iter.next(&value)) != NULL)
328 parser->addAttribute(name, value); 328 parser->addAttribute(name, value);
329 329
330 node = dom.getFirstChild(node, NULL); 330 node = dom.getFirstChild(node, NULL);
331 while (node) 331 while (node)
332 { 332 {
333 walk_dom(dom, node, parser); 333 walk_dom(dom, node, parser);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 SkDebugf("</%s>\n", node->fName); 468 SkDebugf("</%s>\n", node->fName);
469 } 469 }
470 else 470 else
471 SkDebugf("/>\n"); 471 SkDebugf("/>\n");
472 } 472 }
473 } 473 }
474 474
475 void SkDOM::UnitTest() 475 void SkDOM::UnitTest()
476 { 476 {
477 #ifdef SK_SUPPORT_UNITTEST 477 #ifdef SK_SUPPORT_UNITTEST
478 static const char gDoc[] = 478 static const char gDoc[] =
479 "<root a='1' b='2'>" 479 "<root a='1' b='2'>"
480 "<elem1 c='3' />" 480 "<elem1 c='3' />"
481 "<elem2 d='4' />" 481 "<elem2 d='4' />"
482 "<elem3 e='5'>" 482 "<elem3 e='5'>"
483 "<subelem1/>" 483 "<subelem1/>"
484 "<subelem2 f='6' g='7'/>" 484 "<subelem2 f='6' g='7'/>"
485 "</elem3>" 485 "</elem3>"
486 "<elem4 h='8'/>" 486 "<elem4 h='8'/>"
487 "</root>" 487 "</root>"
488 ; 488 ;
(...skipping 14 matching lines...) Expand all
503 503
504 SkASSERT(dom.getFirstChild(root, "elem1")); 504 SkASSERT(dom.getFirstChild(root, "elem1"));
505 SkASSERT(!dom.getFirstChild(root, "subelem1")); 505 SkASSERT(!dom.getFirstChild(root, "subelem1"));
506 506
507 dom.dump(); 507 dom.dump();
508 #endif 508 #endif
509 } 509 }
510 510
511 #endif 511 #endif
512 512
OLDNEW
« no previous file with comments | « src/xml/SkBML_XMLParser.cpp ('k') | src/xml/SkJS.cpp » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b