C++ Writing Own Input Manipulator
<p>I have a data text file which contains this</p>

<pre><code>Map2D, [3, 2]
Dot3D, [25, -69, -33], [-2, -41, 58]
Map3D, [6, 9, -50]
Map2D, [3, 2]
Dot3D, [7, -12, 3], [9, 13, 68]
Map3D, [6, 9, 5]
Map2D, [3, 2]
Dot3D, [70, -120, -3], [-29, 1, 268]
Dot3D, [7, 12, 3], [-9, 13, 68]
Map3D, [1, 3, 8]
Dot2D, [5, 7], [3, 8]
</code></pre>

<p>Basically the text file first data is the class name which i got 4 class</p>

<pre><code>Map2D
Map3D
Dot2D
Dot3D
</code></pre>

<p>I was trying to write my own file manipulator so that my program can extract the data above and overload the extraction operator >> for each of the 4 class and then storing it into relevant object.</p>

<p>I was thinking of using vector, map, set or list to store . but for this how do i achieve what i want to do such as store into relevant object of the class.</p>

<p>I tried googling around on how to create my own file manipulator, but will be good if someone could show me some sample code and i can compile and execute it maybe in a test file then observe the output myself. I would like to use iomanip to do a overload on the >> operator </p>

<p>I am sorry for all the trouble caused. Also can i don't use array to achieve the following storing of data.</p>

<p>I have to use manipulator because i need create something like</p>

<p>I need to do something like </p>

<pre><code>cout &lt;&lt; "Input File Name";
cin &gt;&gt; readFile;
</code></pre>

<p>and perform all the data reading &amp; object creation </p>

<p>then it will read the records line by line, then create the class and also the data in it.</p>

<p><strong>Thanks for all your help!</strong></p>
