JX Application Framework
|
#include <JDirInfo.h>
Classes | |
class | ContentsChanged |
class | ContentsWillBeUpdated |
class | PathChanged |
class | PermissionsChanged |
class | SettingsChanged |
Public Member Functions | |
JDirInfo (const JDirInfo &source) | |
JDirInfo (const JDirInfo &source, const JString &dirName) | |
~JDirInfo () override | |
JDirInfo & | operator= (const JDirInfo &source) |
void | CopySettings (const JDirInfo &source) |
bool | DirectoryExists () const |
const JString & | GetDirectory () const |
bool | IsWritable () const |
JError | GoUp () |
JError | GoDown (const JString &dirName) |
void | GoToClosest (const JString &dirName) |
JError | GoTo (const JString &dirName) |
void | ChangeSort (const std::function< std::weak_ordering(JDirEntry *const &, JDirEntry *const &)> f, const JListT::SortOrder order) |
bool | FilesVisible () const |
void | ShowFiles (const bool show) |
bool | DirsVisible () const |
void | ShowDirs (const bool show) |
bool | HiddenVisible () const |
void | ShowHidden (const bool show) |
bool | VCSDirsVisible () const |
void | ShowVCSDirs (const bool show) |
bool | OthersVisible () const |
void | ShowOthers (const bool show) |
bool | HasWildcardFilter () const |
void | SetWildcardFilter (const JString &filterStr, const bool negate=false, const bool caseSensitive=false) |
void | SetWildcardFilter (JRegex *filter, const bool dirInfoOwnsRegex, const bool negate=false) |
void | ClearWildcardFilter () |
bool | WillApplyWildcardFilterToDirs () const |
void | ShouldApplyWildcardFilterToDirs (const bool apply=true) |
bool | HasDirEntryFilter () const |
void | SetDirEntryFilter (const std::function< bool(const JDirEntry &)> f) |
void | ClearDirEntryFilter () |
bool | HasContentFilter () const |
JError | SetContentFilter (const JString ®exStr) |
void | ClearContentFilter () |
void | ResetCSFFilters () |
void | ChangeProgressDisplay (JProgressDisplay *pg) |
void | UseDefaultProgressDisplay () |
bool | WillSwitchToValidDirectory () const |
void | ShouldSwitchToValidDirectory (const bool switchIfInvalid=true) |
bool | Update (const bool force=false) |
bool | ForceUpdate () |
JSize | GetEntryCount () const |
const JDirEntry & | GetEntry (const JIndex index) const |
bool | FindEntry (const JString &name, JIndex *index) const |
bool | ClosestMatch (const JString &prefixStr, JIndex *index) const |
JDirEntry ** | begin () const |
JDirEntry ** | end () const |
![]() | |
JContainer () | |
JContainer (const JContainer &source) | |
JContainer & | operator= (const JContainer &source) |
![]() | |
JCollection () | |
JCollection (const JCollection &source) | |
~JCollection () override | |
JCollection & | operator= (const JCollection &source) |
JSize | GetItemCount () const |
bool | IsEmpty () const |
bool | IndexValid (const JIndex index) const |
JIndex | GetIndexFromEnd (const JIndex index) const |
JString | ToString () const override |
![]() | |
JBroadcaster () | |
virtual | ~JBroadcaster () |
JBroadcaster & | operator= (const JBroadcaster &source) |
bool | HasSenders () const |
JSize | GetSenderCount () const |
bool | HasRecipients () const |
JSize | GetRecipientCount () const |
template<class T > | |
void | ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f) |
Static Public Member Functions | |
static bool | Create (const JString &dirName, JDirInfo **obj) |
static bool | Create (const JDirInfo &source, const JString &dirName, JDirInfo **obj) |
static bool | OKToCreate (const JString &dirName) |
static bool | BuildRegexFromWildcardFilter (const JString &filterStr, JString *regexStr) |
static bool | Empty (const JString &dirName) |
Static Public Attributes | |
static const JUtf8Byte * | kContentsWillBeUpdated = "ContentsWillBeUpdated::JDirInfo" |
static const JUtf8Byte * | kContentsChanged = "ContentsChanged::JDirInfo" |
static const JUtf8Byte * | kPathChanged = "PathChanged::JDirInfo" |
static const JUtf8Byte * | kPermissionsChanged = "PermissionsChanged::JDirInfo" |
static const JUtf8Byte * | kSettingsChanged = "SettingsChanged::JDirInfo" |
Protected Member Functions | |
JDirInfo (const JString &dirName) | |
virtual bool | IsVisible (const JDirEntry &entry) const |
bool | MatchesNameFilter (const JDirEntry &entry) const |
bool | MatchesDirEntryFilter (const JDirEntry &entry) const |
bool | MatchesContentFilter (const JDirEntry &entry) const |
![]() | |
void | InstallCollection (JCollection *list) |
const JCollection * | GetList () const |
void | Receive (JBroadcaster *sender, const Message &message) override |
![]() | |
void | ItemAdded () |
void | ItemRemoved () |
void | SetItemCount (const JSize newItemCount) |
![]() | |
JBroadcaster (const JBroadcaster &source) | |
void | ListenTo (const JBroadcaster *sender) |
void | StopListening (const JBroadcaster *sender) |
void | ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember) |
void | StopListening (const JBroadcaster *sender, const std::type_info &messageType) |
template<class T > | |
void | Send (JBroadcaster *recipient, const T &message) |
template<class T > | |
void | Broadcast (const T &message) |
void | SendWithFeedback (JBroadcaster *recipient, Message *message) |
void | BroadcastWithFeedback (Message *message) |
virtual void | ReceiveWithFeedback (JBroadcaster *sender, Message *message) |
virtual void | ReceiveGoingAway (JBroadcaster *sender) |
Class that contains information about everything in a given directory. Derived classes can override IsVisible() to perform extra filtering of the list of files. Note that since this class has a constructor function, derived classes must also enforce their own constructor functions. If the contents will merely change due to filtering or updating, instead of changing directories, we broadcast ContentsWillBeUpdated before changing anything. This gives others a chance to save state that can be restored after ContentsChanged. Note that PathChanged cancels the effect of ContentsWillBeUpdated. The content filter is applied in BuildInfo() because it is so expensive and is not likely to change very often since it should not be under user control.
JDirInfo::JDirInfo | ( | const JDirInfo & | source | ) |
|
override |
|
protected |
|
inline |
|
static |
void JDirInfo::ChangeProgressDisplay | ( | JProgressDisplay * | pg | ) |
We take ownership of the object and will delete it when appropriate.
void JDirInfo::ChangeSort | ( | const std::function< std::weak_ordering(JDirEntry *const &, JDirEntry *const &)> | f, |
const JListT::SortOrder | order | ||
) |
void JDirInfo::ClearContentFilter | ( | ) |
void JDirInfo::ClearDirEntryFilter | ( | ) |
void JDirInfo::ClearWildcardFilter | ( | ) |
Returns the index of the closest match for the given name prefix.
void JDirInfo::CopySettings | ( | const JDirInfo & | source | ) |
By forcing everyone to use this function, we avoid having to worry about BuildInfo() succeeding within the class itself.
Note that this prevents one from creating derived classes unless one creates a similar constructor function that checks OKToCreate().
|
inline |
|
inline |
Returns true if the directory doesn't exist or exists and is empty.
Not called IsEmpty(), because that would conflict with our base class, JCollection.
|
inline |
|
inline |
Returns true if an entry with the given name exists.
bool JDirInfo::ForceUpdate | ( | ) |
Returns true if the update was successful. Otherwise, returns false to indicate that path is no longer valid.
|
inline |
|
inline |
void JDirInfo::GoToClosest | ( | const JString & | origDirName | ) |
If the directory exists, go to it. Otherwise, go as far down the directory tree as possible towards the specified directory.
As an example, /usr/include/junk doesn't normally exist, so it will go to /usr/include instead.
JError JDirInfo::GoUp | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void JDirInfo::ResetCSFFilters | ( | ) |
This does not clear the name filter because it is primarily useful for JChooseSaveFile, which doesn't want it changed.
void JDirInfo::SetWildcardFilter | ( | const JString & | filterStr, |
const bool | negate = false , |
||
const bool | caseSensitive = false |
||
) |
void JDirInfo::SetWildcardFilter | ( | JRegex * | filter, |
const bool | dirInfoOwnsRegex, | ||
const bool | negate = false |
||
) |
void JDirInfo::ShouldApplyWildcardFilterToDirs | ( | const bool | apply = true | ) |
|
inline |
void JDirInfo::ShowDirs | ( | const bool | show | ) |
void JDirInfo::ShowFiles | ( | const bool | show | ) |
void JDirInfo::ShowHidden | ( | const bool | show | ) |
void JDirInfo::ShowOthers | ( | const bool | show | ) |
void JDirInfo::ShowVCSDirs | ( | const bool | show | ) |
void JDirInfo::UseDefaultProgressDisplay | ( | ) |
|
inline |
|
inline |
|
inline |
|
static |
|
static |
|
static |
|
static |
|
static |