Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::messages<CharT>::close,std::messages<CharT>::do_close

      From cppreference.com
      <cpp‎ |locale‎ |messages
       
       
       
      Localization library
       
       
      Defined in header<locale>
      public:
      void close( catalog c)const;
      (1)
      protected:
      virtualvoid do_close( catalog c)const;
      (2)
      1) Public member function, calls the protected virtual member functiondo_close of the most derived class.
      2) Releases the implementation-defined resources associated with an open catalog that is designated by the valuec of typecatalog (inherited fromstd::messages_base), which was obtained fromopen().

      Contents

      [edit]Parameters

      c - a valid open catalog identifier, on whichclose() has not yet been called

      [edit]Return value

      (none)

      [edit]Notes

      On POSIX systems, this function call usually translates to a call tocatclose(). In GNU libstdc++, which is implemented in terms of GNUgettext(), it does nothing.

      [edit]Example

      The following example demonstrated retrieval of messages: on a typical GNU/Linux system it reads from/usr/share/locale/de/LC_MESSAGES/sed.mo.

      Run this code
      #include <iostream>#include <locale> int main(){std::locale loc("de_DE.utf8");std::cout.imbue(loc);auto& facet=std::use_facet<std::messages<char>>(loc);auto cat= facet.open("sed", loc);if(cat<0)std::cout<<"Could not open german\"sed\" message catalog\n";elsestd::cout<<"\"No match\" in German: "<< facet.get(cat,0,0,"No match")<<'\n'<<"\"Memory exhausted\" in German: "<< facet.get(cat,0,0,"Memory exhausted")<<'\n';    facet.close(cat);}

      Possible output:

      "No match" in German: Keine Übereinstimmung"Memory exhausted" in German: Speicher erschöpft

      [edit]See also

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/locale/messages/close&oldid=159017"

      [8]ページ先頭

      ©2009-2025 Movatter.jp