- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15.1k
 
[libc] Character converter skeleton class #143619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 2 commits
      Commits
    
    
            Show all changes
          
          
            11 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      4de427f
              
                character converter skeleton class
              
              
                uzairnawaz 6245ef1
              
                fixed formatting
              
              
                uzairnawaz 7c9ad02
              
                license and include guards
              
              
                uzairnawaz 9ac9af3
              
                switched to fixed width types; added internal namespace
              
              
                uzairnawaz f646d43
              
                fixed build dependencies + formatting
              
              
                uzairnawaz 651f168
              
                fixed formatting + added constructor
              
              
                uzairnawaz 4ec2de7
              
                formatting fixes; remove unnecessary dependencies
              
              
                uzairnawaz c145ff8
              
                capitalization fix
              
              
                uzairnawaz e46c1a7
              
                object library for characterconverter class
              
              
                uzairnawaz f216346
              
                added includes to cpp file
              
              
                uzairnawaz 0de4caa
              
                formatting
              
              
                uzairnawaz File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| add_header_library( | ||
| mbstate | ||
| HDRS | ||
| mbstate.h | ||
| DEPENDS | ||
| libc.hdr.types.wchar_t | ||
| ) | ||
| 
     | 
||
| add_header_library( | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| character_converter | ||
| HDRS | ||
| character_converter.h | ||
| DEPENDS | ||
| libc.hdr.types.wchar_t | ||
| .mbstate | ||
| .utf_ret | ||
| ) | ||
| 
     | 
||
| add_header_library( | ||
| utf_ret | ||
| HDRS | ||
| utf_ret.h | ||
| DEPENDS | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| ) | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 
     | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| 
     | 
||
                
      
                  michaelrj-google marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| #include "hdr/types/wchar_t.h" | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| #include "src/__support/wchar/mbstate.h" | ||
| #include "src/__support/wchar/utf_ret.h" | ||
| 
     | 
||
| class CharacterConverter { | ||
                
      
                  michaelrj-google marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| private: | ||
| mbstate_t *state; | ||
| 
     | 
||
| public: | ||
| CharacterConverter(); | ||
| 
     | 
||
| bool isComplete(); | ||
| 
     | 
||
| int push(char utf8_byte); | ||
| int push(wchar_t utf32); | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| utf_ret<char> pop_utf8(); | ||
| utf_ret<wchar_t> pop_utf32(); | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| 
     | 
||
| #include "hdr/types/wchar_t.h" | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| struct mbstate_t { | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| wchar_t partial; | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| unsigned char bits_processed; | ||
| unsigned char total_bytes; | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| 
     | 
||
| template <typename T> struct utf_ret { | ||
                
      
                  uzairnawaz marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| T out; | ||
| int error; | ||
| }; | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.