validate_children.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef VALIDATE_CHILDREN_H
00014 #define VALIDATE_CHILDREN_H
00015 
00016 #include <xml/BContent.h>
00017 
00018 #if _SUPPORTS_NAMESPACE
00019 namespace palmos {
00020 namespace xml {
00021 #endif
00022 
00023 // Give this an elementDecl and it will give you a pointer to the transition
00024 // tables that it uses to do the validating.  This data structure is opaque.
00025 // Don't forget to free it with _free_validate_table_
00026 void        _init_validate_table_(const BElementDecl * decl, const void ** tablePtr);
00027 
00028 // Give this a pointer to a uint16_t.  It initializes it.  Do this before you start.
00029 void        _init_validate_state_(uint16_t * state);
00030 
00031 // Give it the state, the table and an element name.  Will return B_OK if it's
00032 // allowed, and B_XML_CHILD_ELEMENT_NOT_ALLOWED if it's not.
00033 status_t    _check_next_element_(const char * element, uint16_t * state, const void * table);
00034 
00035 // Give it the state and the table, and it will return B_OK if it's okay to
00036 // be done with children here, and B_XML_CHILD_PATTERN_NOT_FINISHED if it's not.
00037 status_t    _check_end_of_element_(uint16_t state, const void * table);
00038 
00039 // Free the private table data
00040 void        _free_validate_table_(const void * tableData);
00041 
00042 #if _SUPPORTS_NAMESPACE
00043 }; // namespace xml
00044 }; // namespace palmos
00045 #endif
00046 
00047 #endif // VALIDATE_CHILDREN_H