Skip to content

Commit

Permalink
move Message::Matches to .cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
whoozle committed Dec 16, 2020
1 parent 53877c9 commit 98179b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
12 changes: 12 additions & 0 deletions mtp/ptp/Messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ namespace mtp { namespace msg
return i != ImageFormats.end();
}

bool DeviceInfo::Matches(const std::string & haystack, const std::string & needle)
{ return strcasestr(haystack.c_str(), needle.c_str()); }

bool DeviceInfo::Matches(const std::string & filter) const
{
if (filter.empty())
return true;
auto fsname = GetFilesystemFriendlyName();
return Matches(fsname, filter);
}


namespace
{
std::string Strip(std::string str)
Expand Down
11 changes: 2 additions & 9 deletions mtp/ptp/Messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,9 @@ namespace mtp { namespace msg

std::string GetFilesystemFriendlyName() const;

static bool Matches(const std::string & haystack, const std::string & needle)
{ return strcasestr(haystack.c_str(), needle.c_str()); }
static bool Matches(const std::string & haystack, const std::string & needle);

bool Matches(const std::string & filter) const
{
if (filter.empty())
return true;
auto fsname = GetFilesystemFriendlyName();
return Matches(fsname, filter);
}
bool Matches(const std::string & filter) const;
};

struct ObjectHandles //! MTP ObjectHandles message
Expand Down

0 comments on commit 98179b5

Please sign in to comment.