Mercurial > jwe > octave
comparison libinterp/corefcn/gzfstream.cc @ 30168:4412f57132c4
maint: use "m_" prefix for member variables in classes gzifstream, gzofstream.
* gzfstream.cc, gzfstream.h: Use "m_" prefix for member variables in classes
gzifstream, gzofstream.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 12 Sep 2021 20:57:27 -0700 |
parents | d809b99f1280 |
children | a61e1a0f6024 |
comparison
equal
deleted
inserted
replaced
30167:5acddd64527e | 30168:4412f57132c4 |
---|---|
520 return ret; | 520 return ret; |
521 } | 521 } |
522 | 522 |
523 // Default constructor initializes stream buffer | 523 // Default constructor initializes stream buffer |
524 gzifstream::gzifstream () | 524 gzifstream::gzifstream () |
525 : std::istream (nullptr), sb () | 525 : std::istream (nullptr), m_sb () |
526 { this->init (&sb); } | 526 { this->init (&m_sb); } |
527 | 527 |
528 // Initialize stream buffer and open file | 528 // Initialize stream buffer and open file |
529 gzifstream::gzifstream (const char *name, std::ios_base::openmode mode) | 529 gzifstream::gzifstream (const char *name, std::ios_base::openmode mode) |
530 : std::istream (nullptr), sb () | 530 : std::istream (nullptr), m_sb () |
531 { | 531 { |
532 this->init (&sb); | 532 this->init (&m_sb); |
533 this->open (name, mode); | 533 this->open (name, mode); |
534 } | 534 } |
535 | 535 |
536 // Initialize stream buffer and attach to file | 536 // Initialize stream buffer and attach to file |
537 gzifstream::gzifstream (int fd, std::ios_base::openmode mode) | 537 gzifstream::gzifstream (int fd, std::ios_base::openmode mode) |
538 : std::istream (nullptr), sb () | 538 : std::istream (nullptr), m_sb () |
539 { | 539 { |
540 this->init (&sb); | 540 this->init (&m_sb); |
541 this->attach (fd, mode); | 541 this->attach (fd, mode); |
542 } | 542 } |
543 | 543 |
544 // Open file and go into fail() state if unsuccessful | 544 // Open file and go into fail() state if unsuccessful |
545 void | 545 void |
546 gzifstream::open (const char *name, std::ios_base::openmode mode) | 546 gzifstream::open (const char *name, std::ios_base::openmode mode) |
547 { | 547 { |
548 if (! sb.open (name, mode | std::ios_base::in)) | 548 if (! m_sb.open (name, mode | std::ios_base::in)) |
549 this->setstate (std::ios_base::failbit); | 549 this->setstate (std::ios_base::failbit); |
550 else | 550 else |
551 this->clear (); | 551 this->clear (); |
552 } | 552 } |
553 | 553 |
554 // Attach to file and go into fail() state if unsuccessful | 554 // Attach to file and go into fail() state if unsuccessful |
555 void | 555 void |
556 gzifstream::attach (int fd, std::ios_base::openmode mode) | 556 gzifstream::attach (int fd, std::ios_base::openmode mode) |
557 { | 557 { |
558 if (! sb.attach (fd, mode | std::ios_base::in)) | 558 if (! m_sb.attach (fd, mode | std::ios_base::in)) |
559 this->setstate (std::ios_base::failbit); | 559 this->setstate (std::ios_base::failbit); |
560 else | 560 else |
561 this->clear (); | 561 this->clear (); |
562 } | 562 } |
563 | 563 |
564 // Close file | 564 // Close file |
565 void | 565 void |
566 gzifstream::close () | 566 gzifstream::close () |
567 { | 567 { |
568 if (! sb.close ()) | 568 if (! m_sb.close ()) |
569 this->setstate (std::ios_base::failbit); | 569 this->setstate (std::ios_base::failbit); |
570 } | 570 } |
571 | 571 |
572 // Default constructor initializes stream buffer | 572 // Default constructor initializes stream buffer |
573 gzofstream::gzofstream () | 573 gzofstream::gzofstream () |
574 : std::ostream (nullptr), sb () | 574 : std::ostream (nullptr), m_sb () |
575 { this->init (&sb); } | 575 { this->init (&m_sb); } |
576 | 576 |
577 // Initialize stream buffer and open file | 577 // Initialize stream buffer and open file |
578 gzofstream::gzofstream (const char *name, std::ios_base::openmode mode) | 578 gzofstream::gzofstream (const char *name, std::ios_base::openmode mode) |
579 : std::ostream (nullptr), sb () | 579 : std::ostream (nullptr), m_sb () |
580 { | 580 { |
581 this->init (&sb); | 581 this->init (&m_sb); |
582 this->open (name, mode); | 582 this->open (name, mode); |
583 } | 583 } |
584 | 584 |
585 // Initialize stream buffer and attach to file | 585 // Initialize stream buffer and attach to file |
586 gzofstream::gzofstream (int fd, std::ios_base::openmode mode) | 586 gzofstream::gzofstream (int fd, std::ios_base::openmode mode) |
587 : std::ostream (nullptr), sb () | 587 : std::ostream (nullptr), m_sb () |
588 { | 588 { |
589 this->init (&sb); | 589 this->init (&m_sb); |
590 this->attach (fd, mode); | 590 this->attach (fd, mode); |
591 } | 591 } |
592 | 592 |
593 // Open file and go into fail() state if unsuccessful | 593 // Open file and go into fail() state if unsuccessful |
594 void | 594 void |
595 gzofstream::open (const char *name, std::ios_base::openmode mode) | 595 gzofstream::open (const char *name, std::ios_base::openmode mode) |
596 { | 596 { |
597 if (! sb.open (name, mode | std::ios_base::out)) | 597 if (! m_sb.open (name, mode | std::ios_base::out)) |
598 this->setstate (std::ios_base::failbit); | 598 this->setstate (std::ios_base::failbit); |
599 else | 599 else |
600 this->clear (); | 600 this->clear (); |
601 } | 601 } |
602 | 602 |
603 // Attach to file and go into fail() state if unsuccessful | 603 // Attach to file and go into fail() state if unsuccessful |
604 void | 604 void |
605 gzofstream::attach (int fd, std::ios_base::openmode mode) | 605 gzofstream::attach (int fd, std::ios_base::openmode mode) |
606 { | 606 { |
607 if (! sb.attach (fd, mode | std::ios_base::out)) | 607 if (! m_sb.attach (fd, mode | std::ios_base::out)) |
608 this->setstate (std::ios_base::failbit); | 608 this->setstate (std::ios_base::failbit); |
609 else | 609 else |
610 this->clear (); | 610 this->clear (); |
611 } | 611 } |
612 | 612 |
613 // Close file | 613 // Close file |
614 void | 614 void |
615 gzofstream::close () | 615 gzofstream::close () |
616 { | 616 { |
617 if (! sb.close ()) | 617 if (! m_sb.close ()) |
618 this->setstate (std::ios_base::failbit); | 618 this->setstate (std::ios_base::failbit); |
619 } | 619 } |
620 | 620 |
621 #endif | 621 #endif |