#include <ArClientFileUtils.h>
Public Member Functions | |
void | addFileReceivedCallback (ArFunctor1< int > *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a callback for when we get the desired file (or fail). | |
ArClientFileToClient (ArClientBase *client) | |
Constructor. | |
void | cancelGet (void) |
Cancels getting a file. | |
const char * | getClientFileName (void) |
Gets the filename we'll save the gotten file in. | |
const char * | getDirectory (void) |
Gets the directory we're getting from. | |
bool | getFileFromDirectory (const char *directory, const char *fileName, const char *clientFileName) |
Get the file from a directory. | |
const char * | getFileName (void) |
Gets the filename we're getting. | |
ArTime | getLastReceived (void) |
Gets the last time we finished getting a file. | |
ArTime | getLastRequested (void) |
Gets the last time we asked for a file. | |
bool | isAvailable (void) |
Sees if the server supports what this class needs. | |
bool | isWaitingForFile (void) |
If we're getting a file now. | |
void | remFileReceivedCallback (ArFunctor1< int > *functor) |
Removes a callback for when we get the desired file (or fail). | |
virtual | ~ArClientFileToClient () |
Destructor. | |
Protected Member Functions | |
void | callFileReceivedCallbacks (int val) |
void | netGetFile (ArNetPacket *packet) |
Protected Attributes | |
ArMutex | myCallbackMutex |
ArClientBase * | myClient |
std::string | myClientFileName |
ArMutex | myDataMutex |
std::string | myDirectory |
FILE * | myFile |
std::string | myFileName |
std::list< ArFunctor1< int > * > | myFileReceivedCallbacks |
ArFunctor1C< ArClientFileToClient, ArNetPacket * > | myGetFileCB |
bool | myIsWaitingForFile |
ArTime | myLastReceived |
ArTime | myLastRequested |
std::string | myWholeFileName |
If you want to find out what files are on the server use ArClientFileLister.
When get a file it doesn't happen right away, but when the file is received (or failes) the fileGotten callbacks will be called, 0 as the int for the callback means everything is good, positive error messages are from the server (1 == tried to go outside allowed area, 2 == no such directory, 3 == empty file name, 4 == problem reading file), negative are from this class (-1 == got directory but it wasn't what we wanted (if you wait the right one might come in, like if someone selects one dir then the other), -2 == can't open file to put result into).
Definition at line 160 of file ArClientFileUtils.h.
|
Constructor.
Definition at line 290 of file ArClientFileUtils.cpp. References ArClientBase::addHandler(), client, myClient, myFile, myGetFileCB, and myIsWaitingForFile. |
|
Destructor.
Definition at line 299 of file ArClientFileUtils.cpp. |
|
Adds a callback for when we get the desired file (or fail).
Definition at line 461 of file ArClientFileUtils.cpp. References ArMutex::lock(), ArLog::log(), myCallbackMutex, myFileReceivedCallbacks, and ArMutex::unlock(). |
|
Definition at line 483 of file ArClientFileUtils.cpp. References ArMutex::lock(), myCallbackMutex, myFileReceivedCallbacks, and ArMutex::unlock(). Referenced by netGetFile(). |
|
Cancels getting a file.
Definition at line 519 of file ArClientFileUtils.cpp. |
|
Gets the filename we'll save the gotten file in.
Definition at line 510 of file ArClientFileUtils.cpp. References ArMutex::lock(), myClientFileName, myDataMutex, and ArMutex::unlock(). |
|
Gets the directory we're getting from.
Definition at line 492 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myDirectory, and ArMutex::unlock(). |
|
Get the file from a directory.
Definition at line 310 of file ArClientFileUtils.cpp. References ArUtil::appendSlash(), ArUtil::fixSlashes(), isAvailable(), ArMutex::lock(), ArLog::log(), myClient, myClientFileName, myDataMutex, myDirectory, myFileName, myIsWaitingForFile, myLastRequested, myWholeFileName, ArClientBase::requestOnce(), ArTime::setToNow(), ArBasePacket::strToBuf(), ArBasePacket::uByte2ToBuf(), and ArMutex::unlock(). |
|
Gets the filename we're getting.
Definition at line 501 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myFileName, and ArMutex::unlock(). |
|
Gets the last time we finished getting a file.
Definition at line 537 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myLastReceived, and ArMutex::unlock(). |
|
Gets the last time we asked for a file.
Definition at line 546 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myLastRequested, and ArMutex::unlock(). |
|
Sees if the server supports what this class needs.
Definition at line 304 of file ArClientFileUtils.cpp. References ArClientBase::dataExists(), and myClient. Referenced by getFileFromDirectory(). |
|
If we're getting a file now.
Definition at line 528 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myIsWaitingForFile, and ArMutex::unlock(). |
|
Definition at line 385 of file ArClientFileUtils.cpp. References callFileReceivedCallbacks(), ArUtil::fixSlashes(), ArMutex::lock(), ArLog::log(), myClientFileName, myDataMutex, myFile, myFileName, myIsWaitingForFile, myLastReceived, myWholeFileName, ArTime::setToNow(), and ArMutex::unlock(). |
|
Removes a callback for when we get the desired file (or fail).
Definition at line 475 of file ArClientFileUtils.cpp. References ArMutex::lock(), myCallbackMutex, myFileReceivedCallbacks, and ArMutex::unlock(). |
|
Definition at line 196 of file ArClientFileUtils.h. Referenced by addFileReceivedCallback(), callFileReceivedCallbacks(), and remFileReceivedCallback(). |
|
Definition at line 197 of file ArClientFileUtils.h. Referenced by ArClientFileToClient(), getFileFromDirectory(), and isAvailable(). |
|
Definition at line 202 of file ArClientFileUtils.h. Referenced by getClientFileName(), getFileFromDirectory(), and netGetFile(). |
|
Definition at line 195 of file ArClientFileUtils.h. Referenced by getClientFileName(), getDirectory(), getFileFromDirectory(), getFileName(), getLastReceived(), getLastRequested(), isWaitingForFile(), and netGetFile(). |
|
Definition at line 199 of file ArClientFileUtils.h. Referenced by getDirectory(), and getFileFromDirectory(). |
|
Definition at line 203 of file ArClientFileUtils.h. Referenced by ArClientFileToClient(), and netGetFile(). |
|
Definition at line 200 of file ArClientFileUtils.h. Referenced by getFileFromDirectory(), getFileName(), and netGetFile(). |
|
Definition at line 206 of file ArClientFileUtils.h. Referenced by addFileReceivedCallback(), callFileReceivedCallbacks(), and remFileReceivedCallback(). |
|
Definition at line 207 of file ArClientFileUtils.h. Referenced by ArClientFileToClient(). |
|
Definition at line 198 of file ArClientFileUtils.h. Referenced by ArClientFileToClient(), getFileFromDirectory(), isWaitingForFile(), and netGetFile(). |
|
Definition at line 205 of file ArClientFileUtils.h. Referenced by getLastReceived(), and netGetFile(). |
|
Definition at line 204 of file ArClientFileUtils.h. Referenced by getFileFromDirectory(), and getLastRequested(). |
|
Definition at line 201 of file ArClientFileUtils.h. Referenced by getFileFromDirectory(), and netGetFile(). |