diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-14 13:47:01 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-04-15 11:36:58 +0000 |
commit | f0461e8360e13137c29dfcc1d20ba93e7bbd3073 (patch) | |
tree | f50b6a25aeb7609f7bc11443bdb18bd2c343af66 /include/svl | |
parent | ba9acdf799bf556c8a20b1dc27eb116e23d481db (diff) |
convert LOCKFILE_ constants to scoped enum and cleanup
Change-Id: I9a2339cc953a718403b3cd0960d5d8d34abae455
Reviewed-on: https://gerrit.libreoffice.org/15304
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include/svl')
-rw-r--r-- | include/svl/documentlockfile.hxx | 4 | ||||
-rw-r--r-- | include/svl/lockfilecommon.hxx | 20 | ||||
-rw-r--r-- | include/svl/sharecontrolfile.hxx | 20 |
3 files changed, 21 insertions, 23 deletions
diff --git a/include/svl/documentlockfile.hxx b/include/svl/documentlockfile.hxx index e698a0e28249..944999450281 100644 --- a/include/svl/documentlockfile.hxx +++ b/include/svl/documentlockfile.hxx @@ -39,14 +39,14 @@ class SVL_DLLPUBLIC DocumentLockFile : public LockFileCommon ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > OpenStream(); - void WriteEntryToStream( const ::com::sun::star::uno::Sequence< OUString >& aEntry, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream ); + void WriteEntryToStream( const LockFileEntry& aEntry, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream ); public: DocumentLockFile( const OUString& aOrigURL ); ~DocumentLockFile(); bool CreateOwnLockFile(); - ::com::sun::star::uno::Sequence< OUString > GetLockData(); + LockFileEntry GetLockData(); bool OverwriteOwnLockFile(); void RemoveFile(); diff --git a/include/svl/lockfilecommon.hxx b/include/svl/lockfilecommon.hxx index 7f32d8494911..767df068180b 100644 --- a/include/svl/lockfilecommon.hxx +++ b/include/svl/lockfilecommon.hxx @@ -30,13 +30,15 @@ #include <osl/mutex.hxx> #include <tools/urlobj.hxx> +#include <o3tl/enumarray.hxx> +#include <vector> -#define LOCKFILE_OOOUSERNAME_ID 0 -#define LOCKFILE_SYSUSERNAME_ID 1 -#define LOCKFILE_LOCALHOST_ID 2 -#define LOCKFILE_EDITTIME_ID 3 -#define LOCKFILE_USERURL_ID 4 -#define LOCKFILE_ENTRYSIZE 5 +enum class LockFileComponent +{ + OOOUSERNAME, SYSUSERNAME, LOCALHOST, EDITTIME, USERURL, LAST=USERURL +}; + +typedef o3tl::enumarray<LockFileComponent,OUString> LockFileEntry; namespace svt { @@ -53,13 +55,13 @@ public: LockFileCommon( const OUString& aOrigURL, const OUString& aPrefix ); ~LockFileCommon(); - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > > ParseList( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer ); - static ::com::sun::star::uno::Sequence< OUString > ParseEntry( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); + static void ParseList( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, std::vector< LockFileEntry > &rOutput ); + static LockFileEntry ParseEntry( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); static OUString ParseName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); static OUString EscapeCharacters( const OUString& aSource ); static OUString GetOOOUserName(); static OUString GetCurrentLocalTime(); - static ::com::sun::star::uno::Sequence< OUString > GenerateOwnEntry(); + static LockFileEntry GenerateOwnEntry(); }; } diff --git a/include/svl/sharecontrolfile.hxx b/include/svl/sharecontrolfile.hxx index 04f46d7a6b7c..26ec50702e2a 100644 --- a/include/svl/sharecontrolfile.hxx +++ b/include/svl/sharecontrolfile.hxx @@ -29,13 +29,8 @@ #include <com/sun/star/io/XTruncate.hpp> #include <svl/lockfilecommon.hxx> - -#define SHARED_OOOUSERNAME_ID LOCKFILE_OOOUSERNAME_ID -#define SHARED_SYSUSERNAME_ID LOCKFILE_SYSUSERNAME_ID -#define SHARED_LOCALHOST_ID LOCKFILE_LOCALHOST_ID -#define SHARED_EDITTIME_ID LOCKFILE_EDITTIME_ID -#define SHARED_USERURL_ID LOCKFILE_USERURL_ID -#define SHARED_ENTRYSIZE LOCKFILE_ENTRYSIZE +#include <o3tl/enumarray.hxx> +#include <vector> namespace svt { @@ -47,7 +42,7 @@ class SVL_DLLPUBLIC ShareControlFile : public LockFileCommon ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable; ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate > m_xTruncate; - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > > m_aUsersData; + std::vector< LockFileEntry > m_aUsersData; void OpenStream(); void Close(); @@ -62,11 +57,12 @@ public: ShareControlFile( const OUString& aOrigURL ); ~ShareControlFile(); - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > > GetUsersData(); - void SetUsersDataAndStore( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > >& aUserNames ); - ::com::sun::star::uno::Sequence< OUString > InsertOwnEntry(); + std::vector< LockFileEntry > GetUsersData(); + void SetUsersDataAndStore( const std::vector< LockFileEntry >& aUserNames ); + LockFileEntry InsertOwnEntry(); bool HasOwnEntry(); - void RemoveEntry( const ::com::sun::star::uno::Sequence< OUString >& aOptionalSpecification = ::com::sun::star::uno::Sequence< OUString >() ); + void RemoveEntry( const LockFileEntry& aOptionalSpecification ); + void RemoveEntry(); void RemoveFile(); }; |