src/include/common/spdm/ParentManagementNode.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 
00020 
00021 #ifndef INCL_PARENT_MANAGEMENT_NODE
00022     #define INCL_PARENT_MANAGEMENT_NODE
00023 
00025     #include "base/fscapi.h"
00026     #include "base/util/ArrayList.h"
00027     #include "spdm/constants.h"
00028     #include "spdm/ManagementNode.h"
00029 
00030     /*
00031      * This class represents a management node with children. It gives a way to
00032      * handle children nodes. It currently ignores node's properties.
00033      *
00034      * See the design documents for more information.
00035      */
00036     class __declspec(dllexport) ParentManagementNode : public ManagementNode {
00037 
00038     protected:
00039         //
00040         // Children are dinamically allocated inside this class and given to
00041         // the list. The list will delete all created objects at descruction
00042         // time.
00043         //
00044         ArrayList children;
00045 
00046     public:
00047         /*
00048          * Constructor.
00049          *
00050          * @param parent - a ManagementNode is usually under the context of a
00051          *                 parent node.
00052          * @param name - the node name
00053          *
00054          */
00055         ParentManagementNode(char*  context, char*  name) EXTRA_SECTION_02;
00056         ~ParentManagementNode() EXTRA_SECTION_02;
00057 
00058 
00059         // ----------------------------------------------------- Virtual methods
00060 
00061         /*
00062          * It always returns an empty string
00063          *
00064          * @param property - the property name
00065          * @param buf - the buffer for the value
00066          * @param len - the buffer size
00067          */
00068         void getPropertyValue(const char*  property, const char* buf, int size) EXTRA_SECTION_02;
00069 
00070 
00071         /*
00072          * It simply ignores the new value
00073          *
00074          * @param property - the property name
00075          * @param value - the property value (zero terminated string)
00076          */
00077         void setPropertyValue(const char*  property, const char* value) EXTRA_SECTION_02;
00078 
00079         /*
00080          * Returns this node's children.
00081          *
00082          * The ManagementNode objects are created with the new operator and
00083          * must be discarded by the caller with the operator delete.
00084          *
00085          * @param children - the buffer where ManagementNode* must be stored
00086          * @param size - the size of the children buffer (number of ManagementNode*) in
00087          *               input; the number of children in output
00088          *
00089          */
00090         void getChildren(ManagementNode** children, int* size) EXTRA_SECTION_02;
00091 
00092         ManagementNode* get(int i) EXTRA_SECTION_02;
00093 
00094         /*
00095          * Returns how many children belong to this node.
00096          *
00097          */
00098         int getChildrenCount() EXTRA_SECTION_02;
00099 
00100         /*
00101          * Adds a new child.
00102          *
00103          * @parent node the new node
00104          */
00105         void addChild(ManagementNode& node) EXTRA_SECTION_02;
00106 
00107         /*
00108          * Creates a new ManagementNode with the exact content of this object.
00109          * The new instance MUST be created with the C++ new opertator.
00110          */
00111         ArrayElement* clone() EXTRA_SECTION_02;
00112 
00118         ManagementNode* operator[] (int i) EXTRA_SECTION_02;
00119 
00120 
00121         // -------------------------------------------------------- Private data
00122     };
00123 
00125 #endif

Generated on Fri Apr 27 12:29:18 2007 for Funambol C++ Client Library by  doxygen 1.5.2