ipfs-chromium
slash_delimited.h
1 #ifndef IPFS_SLASH_DELIMITED_H_
2 #define IPFS_SLASH_DELIMITED_H_
3 
4 #include <iosfwd>
5 #include <string>
6 #include <string_view>
7 
8 namespace google::protobuf::internal {
9 class LogMessage;
10 }
11 
12 namespace ipfs {
16  std::string_view remainder_;
17 
18  public:
19  SlashDelimited() : remainder_{""} {}
22  explicit SlashDelimited(std::string_view unowned);
23  explicit operator bool() const;
24  std::string_view pop();
25  std::string_view pop_all();
26  std::string_view pop_n(std::size_t);
27  std::string_view peek_back() const;
28  std::string pop_back();
29  std::string to_string() const { return std::string{remainder_}; }
30  std::string_view to_view() const { return remainder_; }
31 };
32 } // namespace ipfs
33 
34 std::ostream& operator<<(std::ostream&, ipfs::SlashDelimited const&);
35 google::protobuf::internal::LogMessage& operator<<(
36  google::protobuf::internal::LogMessage&,
37  ipfs::SlashDelimited const&);
38 
39 #endif // IPFS_SLASH_DELIMITED_H_
Definition: slash_delimited.h:15
SlashDelimited(std::string_view unowned)