clang-tidy: use using

Found with modernize-use-using

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2021-04-26 23:49:31 -07:00 committed by Luis Díaz Más
parent b3040da54c
commit bd6a996181
20 changed files with 81 additions and 87 deletions

View File

@ -25,7 +25,7 @@
#include <iomanip>
#include <cassert>
typedef Exiv2::ExifData::const_iterator (*EasyAccessFct)(const Exiv2::ExifData& ed);
using EasyAccessFct = Exiv2::ExifData::const_iterator (*)(const Exiv2::ExifData&);
struct EasyAccess {
const char* label_;

View File

@ -26,9 +26,15 @@
#include <cassert>
#include <string>
typedef std::map<std::string,int> format_t;
typedef format_t::const_iterator format_i;
typedef enum { wolf , csv , json , xml } format_e;
using format_t = std::map<std::string, int>;
using format_i = format_t::const_iterator;
enum format_e
{
wolf,
csv,
json,
xml
};
void syntax(const char* argv[],format_t& formats)
{

View File

@ -60,7 +60,7 @@ struct Token {
bool a; // name is an array eg History[]
int i; // index (indexed from 1) eg History[1]/stEvt:action
};
typedef std::vector<Token> Tokens;
using Tokens = std::vector<Token>;
// "XMP.xmp.MP.RegionInfo/MPRI:Regions[1]/MPReg:Rectangle"
bool getToken(std::string& in,Token& token, std::set<std::string>* pNS=NULL)

View File

@ -156,9 +156,9 @@ enum
class Position;
// globals
typedef std::map<time_t,Position> TimeDict_t;
typedef std::map<time_t,Position>::iterator TimeDict_i;
typedef std::vector<std::string> strings_t;
using TimeDict_t = std::map<time_t, Position>;
using TimeDict_i = std::map<time_t, Position>::iterator;
using strings_t = std::vector<std::string>;
const char* gDeg = NULL ; // string "°" or "deg"
TimeDict_t gTimeDict ;
strings_t gFiles;

View File

@ -65,7 +65,7 @@ namespace Action {
class Task {
public:
//! Shortcut for an auto pointer.
typedef std::unique_ptr<Task> UniquePtr;
using UniquePtr = std::unique_ptr<Task>;
//! Virtual destructor.
virtual ~Task();
//! Virtual copy construction.
@ -150,7 +150,7 @@ namespace Action {
//! Pointer to the one and only instance of this class.
static TaskFactory* instance_;
//! Type used to store Task prototype classes
typedef std::map<TaskType, Task*> Registry;
using Registry = std::map<TaskType, Task*>;
//! List of task types and corresponding prototypes.
Registry registry_;
@ -161,7 +161,7 @@ namespace Action {
public:
virtual ~Print();
virtual int run(const std::string& path);
typedef std::unique_ptr<Print> UniquePtr;
using UniquePtr = std::unique_ptr<Print>;
UniquePtr clone() const;
//! Print the Jpeg comment
@ -191,7 +191,7 @@ namespace Action {
const std::string& key,
const std::string& label ="") const;
//! Type for an Exiv2 Easy access function
typedef Exiv2::ExifData::const_iterator (*EasyAccessFct)(const Exiv2::ExifData& ed);
using EasyAccessFct = Exiv2::ExifData::const_iterator (*)(const Exiv2::ExifData& ed);
/*!
@brief Print one summary line with a label (if provided) and requested
data. A line break is printed only if a label is provided.
@ -217,7 +217,7 @@ namespace Action {
public:
virtual ~Rename();
virtual int run(const std::string& path);
typedef std::unique_ptr<Rename> UniquePtr;
using UniquePtr = std::unique_ptr<Rename>;
UniquePtr clone() const;
private:
@ -229,7 +229,7 @@ namespace Action {
public:
virtual ~Adjust();
virtual int run(const std::string& path);
typedef std::unique_ptr<Adjust> UniquePtr;
using UniquePtr = std::unique_ptr<Adjust>;
UniquePtr clone() const;
private:
@ -252,7 +252,7 @@ namespace Action {
public:
virtual ~Erase();
virtual int run(const std::string& path);
typedef std::unique_ptr<Erase> UniquePtr;
using UniquePtr = std::unique_ptr<Erase>;
UniquePtr clone() const;
/*!
@ -294,7 +294,7 @@ namespace Action {
public:
virtual ~Extract();
virtual int run(const std::string& path);
typedef std::unique_ptr<Extract> UniquePtr;
using UniquePtr = std::unique_ptr<Extract>;
UniquePtr clone() const;
/*!
@ -333,7 +333,7 @@ namespace Action {
public:
virtual ~Insert();
virtual int run(const std::string& path);
typedef std::unique_ptr<Insert> UniquePtr;
using UniquePtr = std::unique_ptr<Insert>;
UniquePtr clone() const;
/*!
@ -374,7 +374,7 @@ namespace Action {
public:
virtual ~Modify();
virtual int run(const std::string& path);
typedef std::unique_ptr<Modify> UniquePtr;
using UniquePtr = std::unique_ptr<Modify>;
UniquePtr clone() const;
Modify() {}
//! Apply modification commands to the \em pImage, return 0 if successful.
@ -407,7 +407,7 @@ namespace Action {
public:
virtual ~FixIso();
virtual int run(const std::string& path);
typedef std::unique_ptr<FixIso> UniquePtr;
using UniquePtr = std::unique_ptr<FixIso>;
UniquePtr clone() const;
private:
@ -425,7 +425,7 @@ namespace Action {
public:
virtual ~FixCom();
virtual int run(const std::string& path);
typedef std::unique_ptr<FixCom> UniquePtr;
using UniquePtr = std::unique_ptr<FixCom>;
UniquePtr clone() const;
private:

View File

@ -69,7 +69,7 @@
#if defined(__MINGW__) || (defined(WIN32) && !defined(__CYGWIN__))
// Windows doesn't provide nlink_t
typedef short nlink_t;
using nlink_t = short;
# include <windows.h>
# include <io.h>
#endif
@ -319,7 +319,7 @@ namespace Exiv2 {
HANDLE hFd = (HANDLE)_get_osfhandle(fileno(fp_));
if (hFd != INVALID_HANDLE_VALUE) {
typedef BOOL (WINAPI * GetFileInformationByHandle_t)(HANDLE, LPBY_HANDLE_FILE_INFORMATION);
using GetFileInformationByHandle_t = BOOL(WINAPI*)(HANDLE, LPBY_HANDLE_FILE_INFORMATION);
HMODULE hKernel = ::GetModuleHandleA("kernel32.dll");
if (hKernel) {
GetFileInformationByHandle_t pfcn_GetFileInformationByHandle = (GetFileInformationByHandle_t)GetProcAddress(hKernel, "GetFileInformationByHandle");
@ -697,7 +697,7 @@ namespace Exiv2 {
// that file has been opened with FILE_SHARE_DELETE by another process,
// like a virus scanner or disk indexer
// (see also http://stackoverflow.com/a/11023068)
typedef BOOL (WINAPI * ReplaceFileW_t)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPVOID, LPVOID);
using ReplaceFileW_t = BOOL(WINAPI*)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPVOID, LPVOID);
HMODULE hKernel = ::GetModuleHandleA("kernel32.dll");
if (hKernel) {
ReplaceFileW_t pfcn_ReplaceFileW = (ReplaceFileW_t)GetProcAddress(hKernel, "ReplaceFileW");
@ -760,7 +760,7 @@ namespace Exiv2 {
// that file has been opened with FILE_SHARE_DELETE by another process,
// like a virus scanner or disk indexer
// (see also http://stackoverflow.com/a/11023068)
typedef BOOL (WINAPI * ReplaceFileA_t)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOID);
using ReplaceFileA_t = BOOL(WINAPI*)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOID);
HMODULE hKernel = ::GetModuleHandleA("kernel32.dll");
if (hKernel) {
ReplaceFileA_t pfcn_ReplaceFileA = (ReplaceFileA_t)GetProcAddress(hKernel, "ReplaceFileA");

View File

@ -104,7 +104,7 @@ namespace Exiv2 {
These functions have access to both the source and destination metadata
containers and store the result directly in the destination container.
*/
typedef void (Converter::*ConvertFct)(const char* from, const char* to);
using ConvertFct = void (Converter::*)(const char*, const char*);
//! Structure to define conversions between two keys.
struct Conversion {
MetadataId metadataId_; //!< Type of metadata for the first key.
@ -1481,7 +1481,7 @@ namespace {
return true;
}
typedef bool (*ConvFct)(std::string& str);
using ConvFct = bool (*)(std::string& str);
struct ConvFctList {
bool operator==(const std::pair<const char*, const char*> &fromTo) const

View File

@ -52,18 +52,13 @@ namespace Exiv2 {
// type definitions
//! Function pointer for functions to decode Exif tags from a CRW entry
typedef void (*CrwDecodeFct)(const CiffComponent&,
const CrwMapping*,
Image&,
ByteOrder);
using CrwDecodeFct = void (*)(const CiffComponent&, const CrwMapping*, Image&, ByteOrder);
//! Function pointer for functions to encode CRW entries from Exif tags
typedef void (*CrwEncodeFct)(const Image&,
const CrwMapping*,
CiffHeader*);
using CrwEncodeFct = void (*)(const Image&, const CrwMapping*, CiffHeader*);
//! Stack to hold a path of CRW directories
typedef std::stack<CrwSubDir> CrwDirs;
using CrwDirs = std::stack<CrwSubDir>;
//! Type to identify where the data is stored in a directory
enum DataLocId {
@ -84,9 +79,9 @@ namespace Exiv2 {
class CiffComponent {
public:
//! CiffComponent auto_ptr type
typedef std::unique_ptr<CiffComponent> UniquePtr;
using UniquePtr = std::unique_ptr<CiffComponent>;
//! Container type to hold all metadata
typedef std::vector<CiffComponent*> Components;
using Components = std::vector<CiffComponent*>;
//! @name Creators
//@{
@ -428,7 +423,7 @@ namespace Exiv2 {
class CiffHeader {
public:
//! CiffHeader auto_ptr type
typedef std::unique_ptr<CiffHeader> UniquePtr;
using UniquePtr = std::unique_ptr<CiffHeader>;
//! @name Creators
//@{

View File

@ -80,7 +80,7 @@ namespace {
class Thumbnail {
public:
//! Shortcut for a %Thumbnail auto pointer.
typedef std::unique_ptr<Thumbnail> UniquePtr;
using UniquePtr = std::unique_ptr<Thumbnail>;
//! @name Creators
//@{
@ -123,7 +123,7 @@ namespace {
class TiffThumbnail : public Thumbnail {
public:
//! Shortcut for a %TiffThumbnail auto pointer.
typedef std::unique_ptr<TiffThumbnail> UniquePtr;
using UniquePtr = std::unique_ptr<TiffThumbnail>;
//! @name Manipulators
//@{
@ -147,7 +147,7 @@ namespace {
class JpegThumbnail : public Thumbnail {
public:
//! Shortcut for a %JpegThumbnail auto pointer.
typedef std::unique_ptr<JpegThumbnail> UniquePtr;
using UniquePtr = std::unique_ptr<JpegThumbnail>;
//! @name Manipulators
//@{

View File

@ -1035,7 +1035,7 @@ void Params::getStdin(Exiv2::DataBuf& buf)
} // Params::getStdin()
typedef std::map<std::string,std::string> long_t;
using long_t = std::map<std::string, std::string>;
int Params::getopt(int argc, char* const Argv[])
{

View File

@ -93,7 +93,7 @@ struct ModifyCmd {
std::string value_; //!< Data
};
//! Container for modification commands
typedef std::vector<ModifyCmd> ModifyCmds;
using ModifyCmds = std::vector<ModifyCmd>;
//! Structure to link command identifiers to strings
struct CmdIdAndString {
CmdId cmdId_; //!< Commands identifier
@ -141,17 +141,17 @@ private:
public:
//! Container for command files
typedef std::vector<std::string> CmdFiles;
using CmdFiles = std::vector<std::string>;
//! Container for commands from the command line
typedef std::vector<std::string> CmdLines;
using CmdLines = std::vector<std::string>;
//! Container to store filenames.
typedef std::vector<std::string> Files;
using Files = std::vector<std::string>;
//! Container for preview image numbers
typedef std::set<int> PreviewNumbers;
using PreviewNumbers = std::set<int>;
//! Container for greps
typedef exv_grep_keys_t Greps;
using Greps = exv_grep_keys_t;
//! Container for keys
typedef std::vector<std::string> Keys;
using Keys = std::vector<std::string>;
/*!
@brief Controls all access to the global Params instance.

View File

@ -362,7 +362,7 @@ namespace Exiv2 {
{
Uri result;
typedef std::string::const_iterator iterator_t;
using iterator_t = std::string::const_iterator;
if ( !uri.length() ) return result;

View File

@ -76,7 +76,7 @@
#define fopen_S(f,n,o) f=fopen(n,o)
#define WINAPI
typedef unsigned long DWORD ;
using DWORD = unsigned long;
#define SOCKET_ERROR -1
#define WSAEWOULDBLOCK EINPROGRESS

View File

@ -51,17 +51,17 @@ namespace Exiv2 {
// class definitions
//! Type for a pointer to a function creating a makernote (image)
typedef TiffComponent* (*NewMnFct)(uint16_t tag,
IfdId group,
IfdId mnGroup,
const byte* pData,
uint32_t size,
ByteOrder byteOrder);
using NewMnFct = TiffComponent* (*)(uint16_t tag,
IfdId group,
IfdId mnGroup,
const byte* pData,
uint32_t size,
ByteOrder byteOrder);
//! Type for a pointer to a function creating a makernote (group)
typedef TiffComponent* (*NewMnFct2)(uint16_t tag,
IfdId group,
IfdId mnGroup);
using NewMnFct2 = TiffComponent* (*)(uint16_t tag,
IfdId group,
IfdId mnGroup);
//! Makernote registry structure
struct TiffMnRegistry {

View File

@ -89,7 +89,7 @@ namespace {
virtual ~Loader() = default;
//! Loader auto pointer
typedef std::unique_ptr<Loader> UniquePtr;
using UniquePtr = std::unique_ptr<Loader>;
//! Create a Loader subclass for requested id
static UniquePtr create(PreviewId id, const Image &image);
@ -114,7 +114,7 @@ namespace {
Loader(PreviewId id, const Image &image);
//! Functions that creates a loader from given parameters
typedef UniquePtr (*CreateFunc)(PreviewId id, const Image &image, int parIdx);
using CreateFunc = UniquePtr (*)(PreviewId, const Image &, int);
//! Structure to list possible loaders
struct LoaderList {

View File

@ -90,7 +90,7 @@ namespace Safe
template <class T>
struct enable_if<true, T>
{
typedef T type;
using type = T;
};
/*!

View File

@ -45,7 +45,7 @@ namespace Exiv2 {
// class definitions
//! TIFF value type.
typedef uint16_t TiffType;
using TiffType = uint16_t;
const TiffType ttUnsignedByte = 1; //!< Exif BYTE type
const TiffType ttAsciiString = 2; //!< Exif ASCII type
@ -172,9 +172,9 @@ namespace Exiv2 {
class TiffComponent {
public:
//! TiffComponent auto_ptr type
typedef std::unique_ptr<TiffComponent> UniquePtr;
using UniquePtr = std::unique_ptr<TiffComponent>;
//! Container type to hold all metadata
typedef std::vector<TiffComponent*> Components;
using Components = std::vector<TiffComponent*>;
//! @name Creators
//@{
@ -801,7 +801,7 @@ namespace Exiv2 {
private:
//! Pointers to the image data (strips) and their sizes.
typedef std::vector<std::pair<const byte*, uint32_t> > Strips;
using Strips = std::vector<std::pair<const byte*, uint32_t>>;
// DATA
Strips strips_; //!< Image strips data (never alloc'd) and sizes
@ -1054,7 +1054,7 @@ namespace Exiv2 {
//@}
//! A collection of TIFF directories (IFDs)
typedef std::vector<TiffDirectory*> Ifds;
using Ifds = std::vector<TiffDirectory*>;
// DATA
IfdId newGroup_; //!< Start of the range of group numbers for the sub-IFDs
@ -1305,10 +1305,10 @@ namespace Exiv2 {
@brief Function pointer type for a function to determine which cfg + def
of a corresponding array set to use.
*/
typedef int (*CfgSelFct)(uint16_t, const byte*, uint32_t, TiffComponent* const);
using CfgSelFct = int (*)(uint16_t, const byte*, uint32_t, TiffComponent* const);
//! Function pointer type for a crypt function used for binary arrays.
typedef DataBuf (*CryptFct)(uint16_t, const byte*, uint32_t, TiffComponent* const);
using CryptFct = DataBuf (*)(uint16_t, const byte*, uint32_t, TiffComponent* const);
//! Defines one tag in a binary array
struct ArrayDef {

View File

@ -73,39 +73,32 @@ namespace Exiv2 {
@brief Function pointer type for a TiffDecoder member function
to decode a TIFF component.
*/
typedef void (TiffDecoder::*DecoderFct)(const TiffEntryBase*);
using DecoderFct = void (TiffDecoder::*)(const TiffEntryBase*);
/*!
@brief Function pointer type for a TiffDecoder member function
to decode a TIFF component.
*/
typedef void (TiffEncoder::*EncoderFct)(TiffEntryBase*, const Exifdatum*);
using EncoderFct = void (TiffEncoder::*)(TiffEntryBase*, const Exifdatum*);
/*!
@brief Type for a function pointer for a function to decode a TIFF component.
*/
typedef DecoderFct (*FindDecoderFct)(const std::string& make,
uint32_t extendedTag,
IfdId group);
using FindDecoderFct = DecoderFct (*)(const std::string& make, uint32_t extendedTag, IfdId group);
/*!
@brief Type for a function pointer for a function to encode a TIFF component.
*/
typedef EncoderFct (*FindEncoderFct)(
const std::string& make,
uint32_t extendedTag,
IfdId group
);
using FindEncoderFct = EncoderFct (*)(const std::string& make, uint32_t extendedTag, IfdId group);
/*!
@brief Type for a function pointer for a function to create a TIFF component.
Use TiffComponent::UniquePtr, it is not used in this declaration only
to reduce dependencies.
*/
typedef std::unique_ptr<TiffComponent> (*NewTiffCompFct)(uint16_t tag, IfdId group);
using NewTiffCompFct = std::unique_ptr<TiffComponent> (*)(uint16_t tag, IfdId group);
//! Stack to hold a path from the TIFF root element to a TIFF entry
typedef std::stack<TiffPathItem> TiffPath;
using TiffPath = std::stack<TiffPathItem>;
//! Type for a list of primary image groups
typedef std::vector<IfdId> PrimaryGroups;
using PrimaryGroups = std::vector<IfdId>;
}} // namespace Internal, Exiv2
#endif // #ifndef TIFFFWD_INT_HPP_

View File

@ -457,7 +457,7 @@ namespace Exiv2 {
ByteOrder byteOrder_; //!< Byte order to use to encode target address
};
//! Type of the list containing an identifier and an address pair.
typedef std::map<OffsetId, OffsetData> OffsetList;
using OffsetList = std::map<OffsetId, OffsetData>;
// DATA
OffsetList offsetList_; //!< List of the offsets to replace

View File

@ -706,9 +706,9 @@ namespace Exiv2 {
//@}
private:
typedef std::map<const byte*, IfdId> DirList;
typedef std::map<uint16_t, int> IdxSeq;
typedef std::vector<TiffComponent*> PostList;
using DirList = std::map<const byte*, IfdId>;
using IdxSeq = std::map<uint16_t, int>;
using PostList = std::vector<TiffComponent*>;
// DATA
const byte* pData_; //!< Pointer to the memory buffer