feisty meow concerns codebase  2.140
filename_list.h
Go to the documentation of this file.
1 #ifndef FILENAME_LIST_CLASS
2 #define FILENAME_LIST_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : filename_list *
7 * Author : Chris Koeritz *
8 * *
9 *******************************************************************************
10 * Copyright (c) 2005-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
17 
19 
27 #include "file_info.h"
28 
29 #include <basis/contracts.h>
30 #include <structures/amorph.h>
31 
32 namespace filesystem {
33 
35 : public structures::amorph<file_info>, public virtual basis::packable
36 {
37 public:
38  filename_list();
39 
40  filename_list &operator =(const filename_list &to_copy);
41 
42  int total_files() const;
44 
45  double total_size() const;
47 
48  bool calculate_progress(const filename &file, double current_offset,
49  int &current_file, double &current_size);
51 
56 
57  void fill(structures::string_array &to_fill);
59 
60  const file_info *find(const filename &to_check) const;
62 
66  int locate(const filename &to_find) const;
68 
69  bool member(const filename &to_check) const;
71 
72  bool member_with_state(const file_info &to_check, file_info::file_similarity comparison_method);
74 
79  basis::astring text_form(int max_lines = MAXINT32) const;
80 
81  virtual int packed_size() const;
82 
83  virtual void pack(basis::byte_array &packed_form) const;
84 
85  virtual bool unpack(basis::byte_array &packed_form);
86 };
87 
88 } //namespace.
89 
90 #endif
91 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
A very common template for a dynamic array of bytes.
Definition: byte_array.h:36
A base class for objects that can pack into an array of bytes.
Definition: byte_array.h:87
Encapsulates some measures and calculations based on a file's contents.
Definition: file_info.h:29
file_similarity
this enum encapsulates how files may be compared.
Definition: file_info.h:32
bool member(const filename &to_check) const
finds the index for "to_find" or returns a negative number.
bool member_with_state(const file_info &to_check, file_info::file_similarity comparison_method)
returns true if the file "to_check" exists in the list with appropriate equivalence.
virtual void pack(basis::byte_array &packed_form) const
Creates a packed form of the packable object in "packed_form".
basis::astring text_form(int max_lines=MAXINT32) const
max_lines is the maximum number of lines to print into the string.
virtual bool unpack(basis::byte_array &packed_form)
Restores the packable from the "packed_form".
int total_files() const
returns the number of files currently held in the list.
const file_info * find(const filename &to_check) const
locates the record of information for the filename "to_check".
double total_size() const
returns the full size of all files listed.
filename_list & operator=(const filename_list &to_copy)
int locate(const filename &to_find) const
bool calculate_progress(const filename &file, double current_offset, int &current_file, double &current_size)
given the last "file" and position, this returns current positioning.
void fill(structures::string_array &to_fill)
stuffs the array "to_fill" with the filesnames from our list.
virtual int packed_size() const
Estimates the space needed for the packed structure.
Provides operations commonly needed on file names.
Definition: filename.h:64
An array of strings with some additional helpful methods.
Definition: string_array.h:32
#define MAXINT32
Maximum 32-bit integer value.
Definition: definitions.h:75
A platform independent way to obtain the timestamp of a file.
Definition: byte_filer.cpp:37