[preservefiles] Tidy up permissions code
- superfluous const - add default constructor - Add octal-string accessor to permissions
This commit is contained in:
parent
1c85a648a4
commit
91c94c6022
@ -21,17 +21,21 @@
|
||||
#include <QStringList>
|
||||
#include "permissions.h"
|
||||
|
||||
Permissions::Permissions(QString p) :
|
||||
Permissions::Permissions() :
|
||||
m_username(),
|
||||
m_group(),
|
||||
m_valid(true),
|
||||
m_valid(false),
|
||||
m_value(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Permissions::Permissions(QString p) : Permissions()
|
||||
{
|
||||
parsePermissions(p);
|
||||
}
|
||||
|
||||
const void Permissions::parsePermissions(const QString& p) {
|
||||
void Permissions::parsePermissions(const QString& p) {
|
||||
|
||||
QStringList segments = p.split(":");
|
||||
|
||||
|
@ -32,22 +32,25 @@ class Permissions
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
* Splits the string @p at the colon (":") into separate elements for
|
||||
* <user>, <group>, and <value> (permissions), where <value> is returned as
|
||||
* an **octal** integer.
|
||||
*/
|
||||
/** @brief Constructor
|
||||
*
|
||||
* Splits the string @p at the colon (":") into separate elements for
|
||||
* <user>, <group>, and <value> (permissions), where <value> is returned as
|
||||
* an **octal** integer.
|
||||
*/
|
||||
Permissions(QString p);
|
||||
|
||||
/** @brief Default constructor of an invalid Permissions. */
|
||||
Permissions();
|
||||
|
||||
bool isValid() const { return m_valid; }
|
||||
QString username() const { return m_username; }
|
||||
QString group() const { return m_group; }
|
||||
int value() const { return m_value; }
|
||||
|
||||
QString octal() const { return QString::number( m_value, 8 ); }
|
||||
|
||||
private:
|
||||
|
||||
const void parsePermissions(QString const &p);
|
||||
void parsePermissions(QString const &p);
|
||||
|
||||
QString m_username;
|
||||
QString m_group;
|
||||
|
Loading…
Reference in New Issue
Block a user