/usr/include/Aria/ArZippable.h is in libaria-dev 2.8.0+repack-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | /*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
#ifndef ARZIPPABLE_H
#define ARZIPPABLE_H
#include "ariaTypedefs.h"
/// Interface to access and modify a specified zip file.
/**
* ArZippable is an abstract base class that defines the methods to add
* and extract files from a zip file.
*
* An ArZippable is expected to be used in a rather "atomic" manner. It can
* be opened in one of two modes (ZIP_MODE or UNZIP_MODE), and the available
* operations are subsequently restricted based on the mode:
* <ul>
* <li>ZIP_MODE: addAll() and addFile()</li>
* <li>UNZIP_MODE: getMemberInfoList(), extractAll(), and extractFile()</li>
* </ul>
* After the files are added to or extracted from the zip file, it should be
* close()'ed.
*
**/
class ArZippable
{
public:
// TODO Mutex for multithreaded access?
// TODO Add more values and allow this to be configured?
enum {
CASE_INSENSITIVE = 2
};
/// Constructor
AREXPORT ArZippable()
{}
/// Destructor
AREXPORT virtual ~ArZippable()
{}
/// Returns the complete file path name of the zip file
AREXPORT virtual const char *getFilePathName() const = 0;
/// Modes in which the zip file may be opened
enum ModeType {
ZIP_MODE, //< Mode for zipping, i.e. adding files to the zip file
UNZIP_MODE //< Mode for unzipping, i.e. extracting files from the zip file
};
/// Opens the zip file in the specified mode
/**
* @param mode the ModeType in which the file should be opened
* @return bool true if the zip file was successfully opened in the specified
* mode; false, otherwise.
**/
AREXPORT virtual bool open(ModeType mode) = 0;
/// Closes the zip file
AREXPORT virtual void close() = 0;
/// Determines whether the zip file exists (according to the file path name)
/**
* @return bool true if the file exists and can be read; false, otherwise
**/
AREXPORT virtual bool exists() const = 0;
/// Determines whether the zip file contains the specified member name
/**
* @param memberName the char * name of the member to be found
* @return bool true if the zip file contains the specified member; false
* otherwise
**/
AREXPORT virtual bool contains(const char *memberName) = 0;
// TODO: Perhaps add a callback to be invoked when isOverwrite is false and
// an overwrite condition is detected
/// Extracts all of the files from the zip file.
/**
* The zip file must have been opened in UNZIP_MODE.
*
* @param destDir the char * name of the directory into which the extracted
* files are to be placed
* @param isOverwrite a bool set to true if an extracted file should overwrite
* an existing file of the same name in the destination directory; false if
* it should be skipped
* @param password an optional char * password to be applied to the extraction
* @return bool set to true if all files were successfully extracted (or
* correctly skipped); false if an error occurred
**/
AREXPORT virtual bool extractAll(const char *destDir,
bool isOverwrite,
const char *password = NULL) = 0;
/// Extracts the specified file from the zip file.
/**
* The zip file must have been opened in UNZIP_MODE.
*
* @param memberName the char * name of the file that should be extracted
* @param destDir the char * name of the directory into which the extracted
* files are to be placed
* @param isOverwrite a bool set to true if an extracted file should overwrite
* an existing file of the same name in the destination directory; false if
* it should be skipped
* @param destFileName an optional char * name of the destination file to be
* written; if NULL, then memberName is used
* @param password an optional char * password to be applied to the extraction
* @return bool set to true if the file was successfully extracted (or
* correctly skipped); false if an error occurred
**/
AREXPORT virtual bool extractFile(const char *memberName,
const char *destDir,
bool isOverwrite,
const char *destFileName = NULL,
const char *password = NULL) = 0;
/// Adds all of the files in the specified directory to the zip file.
/**
* The zip file must have been opened in ZIP_MODE.
*
* @param sourceDir the char * name of the directory from which the files
* are to be added
* @param isIncludeSubDirs a bool set to true if all files in all subdirectories
* should also be added to the zip file; false otherwise
* @param isOverwrite a bool set to true if a file to be added should overwrite
* an existing zip file member of the same name; false if it should be skipped
* @param password an optional char * password to be applied to the addition
* @param flush an optional int indication of how the zip file should be flushed
* when writing (for error recovery); implementation dependent
* @return bool set to true if all files were successfully added (or
* correctly skipped); false if an error occurred
**/
AREXPORT virtual bool addAll(const char *sourceDir,
bool isIncludeSubDirs,
bool isOverwrite,
const char *password = NULL,
int flush = 0) = 0;
/// Adds the specified file to the zip file.
/**
* The zip file must have been opened in ZIP_MODE.
*
* @param memberName the char * name of the member to be added in the zip file
* @param isOverwrite a bool set to true if a file to be added should overwrite
* an existing zip file member of the same name; false if it should be skipped
* @param sourceFileName the char * name of the file to be added
* @param password an optional char * password to be applied to the addition
* @param flush an optional int indication of how the zip file should be flushed
* when writing (for error recovery); implementation dependent
* @return bool set to true if all files were successfully added (or
* correctly skipped); false if an error occurred
**/
AREXPORT virtual bool addFile(const char *memberName,
bool isOverwrite,
const char *sourceFileName,
const char *password,
int flush = 0) = 0;
private:
/// Disabled copy constructor
ArZippable( const ArZippable & );
/// Disabled assignment operator.
ArZippable &operator=( const ArZippable & );
protected:
}; // end class ArZippable
#endif // ARZIPPABLE_H
|