Skip to content

Commit

Permalink
clang-tidy: use using
Browse files Browse the repository at this point in the history
Found with modernize-use-using

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed May 8, 2021
1 parent b0c16eb commit 66a438b
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion samples/easyaccess-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
12 changes: 9 additions & 3 deletions samples/exifdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion samples/exiv2json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions samples/geotag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/exif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//@{
Expand Down Expand Up @@ -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
//@{
Expand All @@ -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
//@{
Expand Down
2 changes: 1 addition & 1 deletion src/exiv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[])
{
Expand Down
2 changes: 1 addition & 1 deletion src/futils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace {
virtual ~Loader() {}

//! 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);
Expand All @@ -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 {
Expand Down

0 comments on commit 66a438b

Please sign in to comment.