wex  v21.04.0
Public Member Functions | List of all members
wex::report::file Class Reference

Combines report::listview and file, giving you a list control with file synchronization support. More...

#include <wex/report/listview-file.h>

Inheritance diagram for wex::report::file:
Inheritance graph
[legend]

Public Member Functions

 file (const std::string &file, const data::listview &data=data::listview())
 Constructor for a data::listview::FILE, opens the file.
 
virtual ~file ()
 Destructor.
 
void after_sorting () override
 Virtual interface.
 
bool is_contents_changed () const override
 Returns whether contents have been changed.
 
bool item_from_text (const std::string &text) override
 Virtual interface. More...
 
void reset_contents_changed () override
 Resets contents changed.
 
void add_items (const std::string &folder, const std::string &files, data::dir::type_t flags)
 Other methods. More...
 
fileget_file ()
 Returns the file.
 
- Public Member Functions inherited from wex::report::listview
 listview (const data::listview &data=data::listview())
 Default constructor.
 
bool Destroy () override
 Destroys the window safely.
 
- Public Member Functions inherited from wex::listview
 listview (const data::listview &data=data::listview())
 Default constructor.
 
virtual const std::string item_to_text (long item_number) const
 Copies the specified item (all columns) to text. More...
 
virtual void items_update ()
 Implement this one if you have images that might be changed after sorting etc.
 
void clear ()
 Other methods. More...
 
void config_get ()
 Sets the configurable parameters to values currently in config.
 
const auto & data () const
 Returns associated data.
 
const auto & field_separator () const
 Returns the field separator.
 
int find_column (const std::string &name) const
 If column is not found, -1 is returned,.
 
const std::string get_item_text (long item_number, const std::string &col_name=std::string()) const
 Returns the item text using item number and column name. More...
 
bool insert_item (const std::vector< std::string > &item, long index=-1)
 Inserts item with provided columns. More...
 
bool load (const std::list< std::string > &l)
 Loads listview from list.
 
void print ()
 Prints the list.
 
void print_preview ()
 Previews the list.
 
const std::list< std::string > save () const
 Saves listview to list.
 
bool set_item (long index, int column, const std::string &label, int imageId=-1)
 Sets an item string field at a particular column. More...
 
bool set_item_image (long item_number, const wxArtID &artid)
 Sets the item image, using the image list. More...
 
bool sort_column (const std::string &column_name, sort_t sort_method=SORT_TOGGLE)
 Sorts on a column specified by column name. More...
 
bool sort_column (int column_no, sort_t sort_method=SORT_TOGGLE)
 Sorts on a column. More...
 
void sort_column_reset ()
 Resets column that was used for sorting.
 
int sorted_column_no () const
 Returns current sorted column no.
 
bool append_columns (const std::vector< column > &cols) override
 Virtual methods from core.
 
bool find_next (const std::string &text, bool find_next=true) override
 Finds next.
 
- Public Member Functions inherited from wex::file
 file ()
 Default constructor.
 
 file (const path &p)
 Constructor taking a path.
 
 file (const path &p, std::ios_base::openmode mode)
 Constructor taking a path, opens the file.
 
 file (const char *filename)
 Constructor taking a filename.
 
 file (const char *filename, std::ios_base::openmode mode)
 Constructor taking a filename, opens the file.
 
 file (const file &rhs)
 Copy constructor.
 
fileoperator= (const file &f)
 Assignment operator.
 
bool check_sync ()
 Checks whether this file can be synced, and syncs (invokes do_file_load) the file if so. More...
 
bool close ()
 Closes the file.
 
bool file_load (const path &p)
 Sets the path, opens the file if asked for, invokes do_file_load, and closes the file again (unless use_stream was invoked).
 
bool file_new (const path &p)
 Sets the path and invokes do_file_new.
 
bool file_save (const path &p=path())
 Sets the path if path is ok, opens the file if asked for, invokes do_file_save, and closes the file again.
 
const pathget_filename () const
 Returns the path.
 
bool is_open () const
 Returns true if file is open.
 
bool is_written () const
 Returns true if file has been written.
 
bool open (std::ios_base::openmode mode=std::ios_base::in)
 Opens current path.
 
bool open (const path &p, std::ios_base::openmode mode=std::ios_base::in)
 Opens specified path.
 
void put (char c)
 Writes char.
 
const std::string * read (std::streampos seek_position=0)
 Reads this file into a buffer.
 
std::fstream & stream ()
 Returns stream.
 
void use_stream (bool use=true)
 Default file is closed after loading, if you call this method, stream remains open.
 
bool write (const char *s, size_t n)
 Writes file from buffer.
 
bool write (const std::string &s)
 Writes file from string.
 

Additional Inherited Members

- Static Public Member Functions inherited from wex::report::listview
static data::listview::type_t type_tool (const tool &tool)
 Returns list type from tool id.
 
- Static Public Member Functions inherited from wex::listview
static int config_dialog (const data::window &data=data::window())
 Shows a dialog with options, returns dialog return code. More...
 
- Protected Member Functions inherited from wex::report::listview
void build_popup_menu (menu &menu) override
 Builds the popup menu.
 

Detailed Description

Combines report::listview and file, giving you a list control with file synchronization support.

Member Function Documentation

◆ add_items()

void wex::report::file::add_items ( const std::string &  folder,
const std::string &  files,
data::dir::type_t  flags 
)

Other methods.

Adds items.

◆ item_from_text()

bool wex::report::file::item_from_text ( const std::string &  text)
overridevirtual

Virtual interface.

Inserts new item with column values from text. Items are separated by newlines, columns by a field separator. Returns true if successful.

Reimplemented from wex::listview.