]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.h
* output_plaintext.C: cosmetics in comment: line length cannot be < 0
[lyx.git] / src / buffer.h
index 98d7669eae4a6de0f6e7b5e00948ce7adc265aac..499293976fe7dc61980cab859f1e46478a35a4c5 100644 (file)
@@ -78,6 +78,13 @@ public:
                buildlog  ///< Literate build log
        };
 
+       /// Result of \c readFile()
+       enum ReadStatus {
+               failure, ///< The file could not be read
+               success, ///< The file could not be read
+               wrongversion ///< The version of the file does not match ours
+       };
+
        /** Constructor
            \param file
            \param b  optional \c false by default
@@ -98,6 +105,8 @@ public:
        /// Load the autosaved file.
        void loadAutoSaveFile();
 
+       /// read a new document from a string
+       bool readString(std::string const &);
        /// load a new file
        bool readFile(support::FileName const & filename);
 
@@ -143,6 +152,8 @@ public:
        */
        bool save() const;
 
+       /// Write document to stream. Returns \c false if unsuccesful.
+       bool write(std::ostream &) const;
        /// Write file. Returns \c false if unsuccesful.
        bool writeFile(support::FileName const &) const;
 
@@ -153,11 +164,12 @@ public:
                           bool output_preamble = true,
                           bool output_body = true);
        /** Export the buffer to LaTeX.
-           If \p os is a file stream, and params().inputenc == "auto", and
-           the buffer contains text in different languages with more than
-           one encoding, then this method will change the encoding
-           associated to \p os. Therefore you must not call this method with
-           a string stream if the output is supposed to go to a file. \code
+           If \p os is a file stream, and params().inputenc is "auto" or
+           "default", and the buffer contains text in different languages
+           with more than one encoding, then this method will change the
+           encoding associated to \p os. Therefore you must not call this
+           method with a string stream if the output is supposed to go to a
+           file. \code
            odocfstream ofs;
            ofs.open("test.tex");
            writeLaTeXSource(ofs, ...);
@@ -188,8 +200,6 @@ public:
        Language const * getLanguage() const;
        /// get l10n translated to the buffers language
        docstring const B_(std::string const & l10n) const;
-       /// translate \p label to the buffer language if possible
-       docstring const translateLabel(docstring const & label) const;
 
        ///
        int runChktex();
@@ -385,9 +395,8 @@ private:
        /** Inserts a file into a document
            \return \c false if method fails.
        */
-       bool readFile(LyXLex &, support::FileName const & filename);
-
-       bool do_writeFile(std::ostream & ofs) const;
+       ReadStatus readFile(LyXLex &, support::FileName const & filename,
+                           bool fromString = false);
 
        /// Use the Pimpl idiom to hide the internals.
        class Impl;