共用方式為


VsTextBufferClass.GetLineData(Int32, LINEDATA[], MARKERDATA[]) Method

Definition

Provides direct, line-oriented access to the text buffer.

public:
 virtual int GetLineData(int iLine, cli::array <Microsoft::VisualStudio::TextManager::Interop::LINEDATA> ^ pLineData, cli::array <Microsoft::VisualStudio::TextManager::Interop::MARKERDATA> ^ pMarkerData) = Microsoft::VisualStudio::TextManager::Interop::IVsTextLines::GetLineData;
public:
 virtual int GetLineData(int iLine, cli::array <Microsoft::VisualStudio::TextManager::Interop::LINEDATA> ^ pLineData, cli::array <Microsoft::VisualStudio::TextManager::Interop::MARKERDATA> ^ pMarkerData);
 virtual int GetLineData(int iLine, std::Array <Microsoft::VisualStudio::TextManager::Interop::LINEDATA> const & pLineData, std::Array <Microsoft::VisualStudio::TextManager::Interop::MARKERDATA> const & pMarkerData);
public virtual int GetLineData (int iLine, Microsoft.VisualStudio.TextManager.Interop.LINEDATA[] pLineData, Microsoft.VisualStudio.TextManager.Interop.MARKERDATA[] pMarkerData);
abstract member GetLineData : int * Microsoft.VisualStudio.TextManager.Interop.LINEDATA[] * Microsoft.VisualStudio.TextManager.Interop.MARKERDATA[] -> int
override this.GetLineData : int * Microsoft.VisualStudio.TextManager.Interop.LINEDATA[] * Microsoft.VisualStudio.TextManager.Interop.MARKERDATA[] -> int
Public Overridable Function GetLineData (iLine As Integer, pLineData As LINEDATA(), pMarkerData As MARKERDATA()) As Integer

Parameters

iLine
Int32

[in] Buffer line to access. This is a zero-based value.

pLineData
LINEDATA[]

[in,out] The filled-in LINEDATA structure. This is allocated by the caller and filled in by the GetLineData(Int32, LINEDATA[], MARKERDATA[]) method.

pMarkerData
MARKERDATA[]

[in, optional] MARKERDATA structure. Use GetMarkerData(Int32, Int32, MARKERDATA[]) to fill the MARKERDATA structure for the line range that you specify. If you want syntax coloring and marker attributes to return in the LINEDATA structure (pLineData), then you need to pass in this parameter.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

Remarks

When you call VsTextBufferClass.GetLineData you are provided with a pointer into the buffer's internal data. You can only use this method to access one line in the buffer at a time.

This method returns data for the line in a LINEDATA structure, and can be used to quickly probe the contents of a buffer. If you want to read text line-by-line, it is much faster to get and read LINEDATA than to call the methods CopyLineText or GetLineText.

Note

VsTextBufferClass.GetLineData uses pointers to the buffer's internal data. The buffer is frozen until the ReleaseLineData method is called. Any successful call to GetLineData must call ReleaseLineData with the same LINEDATA pointer. The parameter pMarkerData, if non-null, indicates that attribute data is also requested. The pMarkerData given must be obtained by a previous call to the GetMarkerData method.

Applies to