LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/libcmis - allowable-actions.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* libcmis
       2                 :            :  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
       3                 :            :  *
       4                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       5                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       6                 :            :  * the License or as specified alternatively below. You may obtain a copy of
       7                 :            :  * the License at http://www.mozilla.org/MPL/
       8                 :            :  *
       9                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      10                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      11                 :            :  * for the specific language governing rights and limitations under the
      12                 :            :  * License.
      13                 :            :  *
      14                 :            :  * Major Contributor(s):
      15                 :            :  * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
      16                 :            :  *
      17                 :            :  *
      18                 :            :  * All Rights Reserved.
      19                 :            :  *
      20                 :            :  * For minor contributions see the git repository.
      21                 :            :  *
      22                 :            :  * Alternatively, the contents of this file may be used under the terms of
      23                 :            :  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
      24                 :            :  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
      25                 :            :  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
      26                 :            :  * instead of those above.
      27                 :            :  */
      28                 :            : #ifndef _ALLOWABLE_ACTIONS_HXX_
      29                 :            : #define _ALLOWABLE_ACTIONS_HXX_
      30                 :            : 
      31                 :            : #include <map>
      32                 :            : #include <string>
      33                 :            : 
      34                 :            : #include <libxml/tree.h>
      35                 :            : 
      36                 :            : #include "exception.hxx"
      37                 :            : 
      38                 :            : namespace libcmis
      39                 :            : {
      40                 :            :     class Object;
      41                 :            : 
      42                 :            :     class ObjectAction
      43                 :            :     {
      44                 :            :         public:
      45                 :            :             enum Type
      46                 :            :             {
      47                 :            :                 DeleteObject,
      48                 :            :                 UpdateProperties,
      49                 :            :                 GetFolderTree,
      50                 :            :                 GetProperties,
      51                 :            :                 GetObjectRelationships,
      52                 :            :                 GetObjectParents,
      53                 :            :                 GetFolderParent,
      54                 :            :                 GetDescendants,
      55                 :            :                 MoveObject,
      56                 :            :                 DeleteContentStream,
      57                 :            :                 CheckOut,
      58                 :            :                 CancelCheckOut,
      59                 :            :                 CheckIn,
      60                 :            :                 SetContentStream,
      61                 :            :                 GetAllVersions,
      62                 :            :                 AddObjectToFolder,
      63                 :            :                 RemoveObjectFromFolder,
      64                 :            :                 GetContentStream,
      65                 :            :                 ApplyPolicy,
      66                 :            :                 GetAppliedPolicies,
      67                 :            :                 RemovePolicy,
      68                 :            :                 GetChildren,
      69                 :            :                 CreateDocument,
      70                 :            :                 CreateFolder,
      71                 :            :                 CreateRelationship,
      72                 :            :                 DeleteTree,
      73                 :            :                 GetRenditions,
      74                 :            :                 GetACL,
      75                 :            :                 ApplyACL
      76                 :            :             };
      77                 :            : 
      78                 :            :         private:
      79                 :            :             Type m_type;
      80                 :            :             bool m_enabled;
      81                 :            :             bool m_valid;
      82                 :            : 
      83                 :            :         public:
      84                 :            :             ObjectAction( xmlNodePtr node );
      85                 :          0 :             virtual ~ObjectAction( ){ }
      86                 :            : 
      87                 :            :             Type getType( ) { return m_type; }
      88                 :            :             bool isEnabled( ) { return m_enabled; }
      89                 :            :             bool isValid( ) { return m_valid; }
      90                 :            : 
      91                 :            :             /** Parses the permission name into one of the enum values or throws
      92                 :            :                 an exception for invalid input strings.
      93                 :            :               */
      94                 :            :             static Type parseType( std::string type ) throw ( Exception );
      95                 :            : 
      96                 :            :     };
      97                 :            : 
      98                 :            :     /** Class providing access to the allowed actions on an object.
      99                 :            :       */
     100                 :            :     class AllowableActions
     101                 :            :     {
     102                 :            :         protected:
     103                 :            :             std::map< ObjectAction::Type, bool > m_states;
     104                 :            : 
     105                 :            :         public:
     106                 :            :             AllowableActions( xmlNodePtr node );
     107                 :            :             AllowableActions( const AllowableActions& copy );
     108                 :            :             virtual ~AllowableActions( );
     109                 :            : 
     110                 :            :             const AllowableActions& operator=( const AllowableActions& copy );
     111                 :            : 
     112                 :            :             /** Returns the permissions for the corresponding actions.
     113                 :            :               */
     114                 :            :             bool isAllowed( ObjectAction::Type action );
     115                 :            : 
     116                 :            :             /** Returns true if the action was defined, false if the default
     117                 :            :                 value is used.
     118                 :            :               */
     119                 :            :             bool isDefined( ObjectAction::Type action );
     120                 :            :     };
     121                 :            : }
     122                 :            : 
     123                 :            : #endif

Generated by: LCOV version 1.10